<!doctype html><html lang="en">
 <head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>CSS Ruby Layout Module Level 1</title>
  <meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
  <meta content="exploring" name="csswg-work-status">
  <meta content="ED" name="w3c-status">
  <meta content="“Ruby”, a form of interlinear annotation, are short runs of text alongside the base text.  They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation.  This module describes the rendering model and formatting controls related to displaying ruby annotations in CSS." name="abstract">
  <link href="../default.css" rel="stylesheet" type="text/css">
  <link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<style>
  body {
    background: url("https://www.w3.org/StyleSheets/TR/logo-ED") top left no-repeat;
  }
  </style>
  <link href="https://www.w3.org/TR/css-ruby-1/" rel="canonical">
<script defer src="https://test.csswg.org/harness/annotate.js#!css-ruby-1_dev/css-ruby-1" type="text/javascript"></script>
<style>/* style-md-lists */

/* This is a weird hack for me not yet following the commonmark spec
   regarding paragraph and lists. */
[data-md] > :first-child {
    margin-top: 0;
}
[data-md] > :last-child {
    margin-bottom: 0;
}</style>
<style>/* style-counters */

body {
    counter-reset: example figure issue;
}
.issue {
    counter-increment: issue;
}
.issue:not(.no-marker)::before {
    content: "Issue " counter(issue);
}

.example {
    counter-increment: example;
}
.example:not(.no-marker)::before {
    content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
    content: "Invalid Example" counter(example);
}

figcaption {
    counter-increment: figure;
}
figcaption:not(.no-marker)::before {
    content: "Figure " counter(figure) " ";
}</style>
<style>/* style-dfn-panel */

.dfn-panel {
    position: absolute;
    z-index: 35;
    height: auto;
    width: -webkit-fit-content;
    width: fit-content;
    max-width: 300px;
    max-height: 500px;
    overflow: auto;
    padding: 0.5em 0.75em;
    font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
    background: #DDDDDD;
    color: black;
    border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
    display: inline-block;
    position: fixed;
    left: .5em;
    bottom: 2em;
    margin: 0 auto;
    max-width: calc(100vw - 1.5em - .4em - .5em);
    max-height: 30vh;
}

.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-selflinks */

.heading, .issue, .note, .example, li, dt {
    position: relative;
}
a.self-link {
    position: absolute;
    top: 0;
    left: calc(-1 * (3.5rem - 26px));
    width: calc(3.5rem - 26px);
    height: 2em;
    text-align: center;
    border: none;
    transition: opacity .2s;
    opacity: .5;
}
a.self-link:hover {
    opacity: 1;
}
.heading > a.self-link {
    font-size: 83%;
}
li > a.self-link {
    left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
    top: auto;
    left: auto;
    opacity: 0;
    width: 1.5em;
    height: 1.5em;
    background: gray;
    color: white;
    font-style: normal;
    transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
    opacity: 1;
}
dfn > a.self-link:hover {
    color: black;
}

a.self-link::before            { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before      { content: "#"; }</style>
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
    color: #005a9c;
    font-size: inherit;
    font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
    content: "‘";
}
.css::after, .property::after, .descriptor::after {
    content: "’";
}
.property, .descriptor {
    /* Don't wrap property and descriptor names */
    white-space: nowrap;
}
.type { /* CSS value <type> */
    font-style: italic;
}
pre .property::before, pre .property::after {
    content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
    content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
    content: "’";
}

[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
    content: "";
}

[data-link-type=element],
[data-link-type=element-attr] {
    font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
    font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after  { content: ">" }

[data-link-type=biblio] {
    white-space: pre;
}</style>
 <body class="h-entry">
  <div class="head">
   <p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
   <h1 class="p-name no-ref" id="title">CSS Ruby Layout Module Level 1</h1>
   <h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="1970-01-01">1 January 1970</time></span></h2>
   <details>
    <summary>Specification Metadata</summary>
    <div data-fill-with="spec-metadata">
     <dl>
      <dt>This version:
      <dd><a class="u-url" href="https://drafts.csswg.org/css-ruby-1/">https://drafts.csswg.org/css-ruby-1/</a>
      <dt>Latest published version:
      <dd><a href="https://www.w3.org/TR/css-ruby-1/">https://www.w3.org/TR/css-ruby-1/</a>
      <dt>Previous Versions:
      <dd><a href="https://www.w3.org/TR/2014/WD-css-ruby-1-20140805/" rel="prev">https://www.w3.org/TR/2014/WD-css-ruby-1-20140805/</a>
      <dd><a href="https://www.w3.org/TR/2013/WD-css3-ruby-20130919/" rel="prev">https://www.w3.org/TR/2013/WD-css3-ruby-20130919/</a>
      <dt>Test Suite:
      <dd><a href="http://test.csswg.org/suites/css-ruby-1_dev/nightly-unstable/">http://test.csswg.org/suites/css-ruby-1_dev/nightly-unstable/</a>
      <dt class="editor">Editors:
      <dd class="editor p-author h-card vcard" data-editor-id="35400"><a class="p-name fn u-url url" href="http://fantasai.inkedblade.net/contact">Elika J. Etemad / fantasai</a> (<span class="p-org org">Invited Expert</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="45369"><a class="p-name fn u-email email" href="mailto:kojiishi@gmail.com">Koji Ishii</a> (<span class="p-org org">Google</span>)
      <dd class="editor p-author h-card vcard" data-editor-id="73936"><a class="p-name fn u-url url" href="https://www.upsuper.org/">Xidorn Quan</a> (<a class="p-org org" href="https://www.mozilla.org/">Mozilla</a>)
      <dt>Suggest an Edit for this Spec:
      <dd><a href="https://github.com/w3c/csswg-drafts/blob/master/css-ruby-1/Overview.bs">GitHub Editor</a>
      <dt>Issue Tracking:
      <dd><a href="https://github.com/w3c/csswg-drafts/labels/css-ruby-1">GitHub Issues</a>
     </dl>
    </div>
   </details>
   <div data-fill-with="warning"></div>
   <p class="copyright" data-fill-with="copyright"><a href="https://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 1970 <a href="https://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="https://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="https://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="https://www.keio.ac.jp/">Keio</a>, <a href="https://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="https://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="https://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document">permissive document license</a> rules apply. </p>
   <hr title="Separator for header">
  </div>
  <div class="p-summary" data-fill-with="abstract">
   <h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
   <p>“Ruby”, a form of interlinear annotation, are short runs of text alongside the base text.

They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation.
This module describes the rendering model and formatting controls related to displaying ruby annotations in CSS.</p>
    <a href="https://www.w3.org/TR/CSS/">CSS</a> is a language for describing the rendering of structured documents
(such as HTML and XML)
on screen, on paper, etc. 
  </div>
  <h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
  <div data-fill-with="status">
   <p> This is a public copy of the editors’ draft.
	It is provided for discussion only and may change at any moment.
	Its publication here does not imply endorsement of its contents by W3C.
	Don’t cite this document other than as work in progress. </p>
   <p> <a href="https://github.com/w3c/csswg-drafts/issues">GitHub Issues</a> are preferred for discussion of this specification.
	When filing an issue, please put the text “css-ruby” in the title,
	preferably like this:
	“[css-ruby] <i data-lt>…summary of comment…</i>”.
	All issues and comments are <a href="https://lists.w3.org/Archives/Public/public-css-archive/">archived</a>,
	and there is also a <a href="https://lists.w3.org/Archives/Public/www-style/">historical archive</a>. </p>
   <p> This document was produced by the <a href="https://www.w3.org/Style/CSS/">CSS Working Group</a>. </p>
   <p> This document was produced by a group operating under
	the <a href="https://www.w3.org/Consortium/Patent-Policy/">W3C Patent Policy</a>.
	W3C maintains a <a href="https://www.w3.org/2004/01/pp-impl/32061/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group;
	that page also includes instructions for disclosing a patent.
	An individual who has actual knowledge of a patent which the individual believes contains <a href="https://www.w3.org/Consortium/Patent-Policy/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="https://www.w3.org/Consortium/Patent-Policy/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
   <p> This document is governed by the <a href="https://www.w3.org/2019/Process-20190301/" id="w3c_process_revision">1 March 2019 W3C Process Document</a>. </p>
   <p></p>
  </div>
  <div data-fill-with="at-risk"></div>
  <nav data-fill-with="table-of-contents" id="toc">
   <h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
   <ol class="toc" role="directory">
    <li>
     <a href="#intro"><span class="secno">1</span> <span class="content"> Introduction</span></a>
     <ol class="toc">
      <li><a href="#placement"><span class="secno">1.1</span> <span class="content"> Module interactions</span></a>
      <li><a href="#values"><span class="secno">1.2</span> <span class="content"> Values</span></a>
      <li><a href="#diagram-conventions"><span class="secno">1.3</span> <span class="content"> Diagram conventions</span></a>
      <li><a href="#ruby-def"><span class="secno">1.4</span> <span class="content"> What is ruby?</span></a>
     </ol>
    <li>
     <a href="#ruby-model"><span class="secno">2</span> <span class="content"> Ruby Box Model</span></a>
     <ol class="toc">
      <li>
       <a href="#ruby-display"><span class="secno">2.1</span> <span class="content"> Ruby-specific <span class="property">display</span> Values</span></a>
       <ol class="toc">
        <li><a href="#formatting-context"><span class="secno">2.1.1</span> <span class="content"> The Ruby Formatting Context</span></a>
        <li><a href="#block-ruby"><span class="secno">2.1.2</span> <span class="content"> Non-Inline Ruby</span></a>
       </ol>
      <li><a href="#box-fixup"><span class="secno">2.2</span> <span class="content"> Anonymous Ruby Box Generation</span></a>
      <li>
       <a href="#ruby-pairing"><span class="secno">2.3</span> <span class="content"> Annotation Pairing</span></a>
       <ol class="toc">
        <li><a href="#segment-pairing"><span class="secno">2.3.1</span> <span class="content"> Segment Pairing and Annotation Levels</span></a>
        <li><a href="#base-annotation-pairing"><span class="secno">2.3.2</span> <span class="content"> Unit Pairing and Spanning Annotations</span></a>
        <li><a href="#nested-pairing"><span class="secno">2.3.3</span> <span class="content"> Complex Spanning with Nested Ruby</span></a>
       </ol>
      <li><a href="#autohide"><span class="secno">2.4</span> <span class="content"> Autohiding Base-identical Annotations</span></a>
      <li><a href="#white-space"><span class="secno">2.5</span> <span class="content"> White Space Collapsing</span></a>
     </ol>
    <li>
     <a href="#ruby-layout"><span class="secno">3</span> <span class="content"> Ruby Layout</span></a>
     <ol class="toc">
      <li><a href="#inter-character-layout"><span class="secno">3.1</span> <span class="content"> Inter-character Ruby Layout</span></a>
      <li><a href="#box-style"><span class="secno">3.2</span> <span class="content"> Styling Ruby Boxes</span></a>
      <li>
       <a href="#line-breaks"><span class="secno">3.3</span> <span class="content"> Breaking Across Lines</span></a>
       <ol class="toc">
        <li><a href="#break-between"><span class="secno">3.3.1</span> <span class="content"> Breaking Between Bases</span></a>
        <li><a href="#break-within"><span class="secno">3.3.2</span> <span class="content"> Breaking Within Bases</span></a>
       </ol>
      <li><a href="#bidi"><span class="secno">3.4</span> <span class="content"> Bidi Reordering</span></a>
      <li><a href="#line-height"><span class="secno">3.5</span> <span class="content"> Line Spacing</span></a>
     </ol>
    <li>
     <a href="#ruby-props"><span class="secno">4</span> <span class="content"> Ruby Formatting Properties</span></a>
     <ol class="toc">
      <li><a href="#rubypos"><span class="secno">4.1</span> <span class="content"> Ruby Positioning: the <span class="property">ruby-position</span> property</span></a>
      <li><a href="#collapsed-ruby"><span class="secno">4.2</span> <span class="content"> Sharing Annotation Space: the <span class="property">ruby-merge</span> property</span></a>
      <li><a href="#ruby-align-property"><span class="secno">4.3</span> <span class="content"><span></span> Ruby Text Distribution: the <span class="property">ruby-align</span> property</span></a>
      <li><a href="#ruby-text-decoration"><span class="secno">4.4</span> <span class="content"> Ruby Text Decoration</span></a>
     </ol>
    <li>
     <a href="#edge-effects"><span class="secno">5</span> <span class="content"> Edge Effects</span></a>
     <ol class="toc">
      <li><a href="#ruby-overhang"><span class="secno">5.1</span> <span class="content"> Overhanging Ruby</span></a>
      <li><a href="#line-edge"><span class="secno">5.2</span> <span class="content"> Line-edge Alignment</span></a>
     </ol>
    <li>
     <a href="#default-stylesheet"><span class="secno"></span> <span class="content"> Appendix A: Default Style Sheet</span></a>
     <ol class="toc">
      <li><a href="#default-ua-ruby"><span class="secno"></span> <span class="content"> <span class="secno">A.1</span> Supporting Ruby Layout</span></a>
      <li><a href="#default-inline"><span class="secno"></span> <span class="content"> <span class="secno">A.2</span> Inlining Ruby Annotations</span></a>
      <li><a href="#default-parens"><span class="secno"></span> <span class="content"> <span class="secno">A.3</span> Generating Parentheses</span></a>
     </ol>
    <li><a href="#glossary"><span class="secno">6</span> <span class="content"> Glossary</span></a>
    <li><a href="#acknowledgments"><span class="secno"></span> <span class="content"> Acknowledgments</span></a>
    <li>
     <a href="#changes"><span class="secno"></span> <span class="content"> Changes</span></a>
     <ol class="toc">
      <li><a href="#changes-20140805"><span class="secno"></span> <span class="content"> Changes since the 5 August 2014 WD</span></a>
      <li><a href="#changes-20130919"><span class="secno"></span> <span class="content"> Changes since the 19 September 2013 WD</span></a>
      <li><a href="#changes-20110630"><span class="secno"></span> <span class="content"> Changes since the 30 June 2011 WD</span></a>
     </ol>
    <li>
     <a href="#conformance"><span class="secno"></span> <span class="content"> Conformance</span></a>
     <ol class="toc">
      <li><a href="#document-conventions"><span class="secno"></span> <span class="content"> Document conventions</span></a>
      <li><a href="#conform-classes"><span class="secno"></span> <span class="content"> Conformance classes</span></a>
      <li>
       <a href="#conform-responsible"><span class="secno"></span> <span class="content"> Requirements for Responsible Implementation of CSS</span></a>
       <ol class="toc">
        <li><a href="#conform-partial"><span class="secno"></span> <span class="content"> Partial Implementations</span></a>
        <li><a href="#conform-future-proofing"><span class="secno"></span> <span class="content"> Implementations of Unstable and Proprietary Features</span></a>
        <li><a href="#conform-testing"><span class="secno"></span> <span class="content"> Implementations of CR-level Features</span></a>
       </ol>
     </ol>
    <li>
     <a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
     <ol class="toc">
      <li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
      <li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
     </ol>
    <li>
     <a href="#references"><span class="secno"></span> <span class="content">References</span></a>
     <ol class="toc">
      <li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
      <li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
     </ol>
    <li><a href="#property-index"><span class="secno"></span> <span class="content">Property Index</span></a>
    <li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
   </ol>
  </nav>
  <main>
   <h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content"> Introduction</span><a class="self-link" href="#intro"></a></h2>
   <p><em>This section is not normative.</em> </p>
   <h3 class="heading settled" data-level="1.1" id="placement"><span class="secno">1.1. </span><span class="content"> Module interactions</span><a class="self-link" href="#placement"></a></h3>
   <p>This module extends the inline box model of CSS Level 2 <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> to support ruby. </p>
   <p>None of the properties in this module apply to the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line">::first-line</a> or <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter" id="ref-for-selectordef-first-letter">::first-letter</a> pseudo-elements,
	except for <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position">ruby-position</a> which applies to <span class="css" id="ref-for-selectordef-first-line①">::first-line</span>,
	inheriting to affect ruby annotations on the first line. </p>
   <h3 class="heading settled" data-level="1.2" id="values"><span class="secno">1.2. </span><span class="content"> Values</span><a class="self-link" href="#values"></a></h3>
   <p>This specification follows the <a href="https://www.w3.org/TR/CSS2/about.html#property-defs">CSS property definition conventions</a> from <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a>.
	Value types not defined in this specification are defined in CSS Values &amp; Units <a data-link-type="biblio" href="#biblio-css-values-3">[CSS-VALUES-3]</a>.
	Other CSS modules may expand the definitions of these value types.</p>
   <p>In addition to the property-specific values listed in their definitions,
	all properties defined in this specification
	also accept the <a data-link-type="dfn" href="https://drafts.csswg.org/css-values-4/#css-wide-keywords" id="ref-for-css-wide-keywords">CSS-wide keywords</a> keywords as their property value.
	For readability they have not been repeated explicitly.</p>
   <h3 class="heading settled" data-level="1.3" id="diagram-conventions"><span class="secno">1.3. </span><span class="content"> Diagram conventions</span><a class="self-link" href="#diagram-conventions"></a></h3>
   <p>Many typographical conventions in East Asian typography depend
	on whether the character rendered is wide (CJK) or narrow (non-CJK).
	There are a number of illustrations in this document
	for which the following legend is used: </p>
   <dl>
    <dt><img alt="Symbolic wide-cell glyph representation" height="39" src="images/fullwidth.gif" width="39"> 
    <dd>Wide-cell glyph (e.g. Han) that is the <var>n</var>th character in the text run.
		They are typically sized to 50% when used as annotations. 
    <dt><img alt="Symbolic narrow-cell glyph representation" height="39" src="images/halfwidth.gif" width="19"> 
    <dd>Narrow-cell glyph (e.g. Roman) which is the <var>n</var>th glyph in the text run. 
   </dl>
   <p>The orientation which the above symbols assume in the diagrams
	corresponds to the orientation that the glyphs they represent
	are intended to assume when rendered by the user agent.
	Spacing between these characters in the diagrams is incidental,
	unless intentionally changed to make a point. </p>
   <h3 class="heading settled" data-level="1.4" id="ruby-def"><span class="secno">1.4. </span><span class="content"> What is ruby?</span><a class="self-link" href="#ruby-def"></a></h3>
   <p><dfn data-dfn-type="dfn" data-export id="ruby">Ruby<a class="self-link" href="#ruby"></a></dfn> is the commonly-used name for a run of text
	that appears alongside another run of text (referred to as the “base”)
	and serves as an annotation or a pronunciation guide associated with that run of text. </p>
   <p>The following figures show two examples of Ruby,
	a simple case and one with more complicated structure. </p>
   <div class="example" id="example-30c5764f">
    <a class="self-link" href="#example-30c5764f"></a> 
    <p>In this first example, a single annotation is used to annotate the base text. </p>
    <div class="figure">
     <p><img alt="Example of ruby applied on top of a Japanese expression" src="images/licence.png"> </p>
     <p class="caption">Example of ruby used in Japanese (simple case) </p>
    </div>
    <p>In Japanese typography, this case is sometimes called <span lang="ja">taigo</span> ruby or group-ruby (per-word ruby),
		because the annotation as a whole is associated
		with multi-character word (as a whole). </p>
   </div>
   <div class="example" id="example-2c64627d">
    <a class="self-link" href="#example-2c64627d"></a> 
    <p>In this second example,
		two levels of annotations are attached to a base sequence:
		the hiragana characters on top refer to the pronunciation of each of the base kanji characters,
		while the words “Keio” and “University” on the bottom are annotations describing the English translation. </p>
    <div class="figure">
     <p><img alt="Example showing complex ruby with annotation text over and under the base characters" src="images/ruby-univ.gif"> </p>
     <p class="caption">Complex ruby with annotation text over and under the base characters </p>
    </div>
    <p></p>
    <p>Notice that to allow correct association between the hiragana characters and
		their corresponding Kanji base characters,
		the spacing between these Kanji characters is adjusted.
		(This happens around the fourth Kanji character in the figure above.)
		To avoid variable spacing between the Kanji characters in the example above
		the hiragana annotations can be styled as a <i>collapsed annotation</i>,
		which will look more like the group-ruby example earlier.
		However because the base-annotation pairings are recorded in the ruby structure,
		if the text breaks across lines, the annotation characters will stay
		correctly paired with their respective base characters. </p>
   </div>
   <p><i>Ruby</i> formatting as used in Japanese is described in JIS X-4051 <a data-link-type="biblio" href="#biblio-jis4051">[JIS4051]</a> (in Japanese)
	and in Requirements for Japanese Text Layout <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a> (in English and Japanese)].
	In HTML, ruby structure and markup to represent it is described
	in the Ruby Markup Extension specification.
	This module describes the CSS rendering model
	and formatting controls relevant to ruby layout of such markup. </p>
   <h2 class="heading settled" data-level="2" id="ruby-model"><span class="secno">2. </span><span class="content"> Ruby Box Model</span><a class="self-link" href="#ruby-model"></a></h2>
   <p>The CSS ruby model is based on
	the <a href="https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element">W3C HTML5 Ruby Markup</a> model
	and the <a href="https://www.w3.org/TR/ruby/">XHTML Ruby Annotation Recommendation</a> <a data-link-type="biblio" href="#biblio-ruby">[RUBY]</a>.
	In this model, a ruby structure consists of
	one or more <i>ruby base</i> elements representing the base (annotated) text,
	associated with one or more levels of <i>ruby annotation</i> elements representing the annotations.
	The structure of ruby is similar to that of a table:
	there are “rows” (the <i data-lt="base level">base text level</i>, each <i>annotation level</i>)
	and “columns” (each <i>ruby base</i> and its corresponding <i>ruby annotations</i>). </p>
   <p>Consecutive bases and annotations are grouped together into <i>ruby segments</i>.
	Within a <i>ruby segment</i>, a <i>ruby annotation</i> may span multiple <i>ruby bases</i>. </p>
   <p class="note" role="note">In HTML, a single <code>&lt;ruby></code> element may contain multiple <i>ruby segments</i>.
	(In the XHTML Ruby model, a single <code>&lt;ruby></code> element can only contain one <i>ruby segment</i>.) </p>
   <h3 class="heading settled" data-level="2.1" id="ruby-display"><span class="secno">2.1. </span><span class="content"> Ruby-specific <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display">display</a> Values</span><a class="self-link" href="#ruby-display"></a></h3>
   <p>For document languages (such as XML applications) that do not have pre-defined ruby elements,
	authors must map document language elements to ruby elements;
	this is done with the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display①">display</a> property. </p>
   <table class="def propdef partial" data-link-for-hint="display">
    <tbody>
     <tr>
      <th>Name:
      <td><a class="css" data-link-type="property" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display②">display</a>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">New values:</a>
      <td class="prod">ruby <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one">|</a> ruby-base <span id="ref-for-comb-one①">|</span> ruby-text <span id="ref-for-comb-one②">|</span> ruby-base-container <span id="ref-for-comb-one③">|</span> ruby-text-container 
   </table>
   <p>The following new <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display③">display</a> values assign ruby layout roles to an arbitrary element: </p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-for="display" data-dfn-type="value" data-export id="valdef-display-ruby">ruby</dfn> 
    <dd>Specifies that an element generates a <dfn data-dfn-for data-dfn-type="dfn" data-export data-lt="ruby container | ruby container box" id="ruby-container">ruby container box<a class="self-link" href="#ruby-container"></a></dfn>.
			(Corresponds to HTML/XHTML <code>&lt;ruby></code> elements.) 
    <dt><dfn class="css" data-dfn-for="display" data-dfn-type="value" data-export id="valdef-display-ruby-base">ruby-base<a class="self-link" href="#valdef-display-ruby-base"></a></dfn> 
    <dd>Specifies that an element generates a <dfn data-dfn-for data-dfn-type="dfn" data-export data-lt="ruby base box | ruby base" id="ruby-base-box">ruby base box<a class="self-link" href="#ruby-base-box"></a></dfn>.
			(Corresponds to HTML/XHTML <code>&lt;rb></code> elements.) 
    <dt><dfn class="css" data-dfn-for="display" data-dfn-type="value" data-export id="valdef-display-ruby-text">ruby-text<a class="self-link" href="#valdef-display-ruby-text"></a></dfn> 
    <dd>Specifies that an element generates a <dfn data-dfn-for data-dfn-type="dfn" data-export data-lt="ruby annotation box | ruby annotation | annotation" id="ruby-annotation-box">ruby annotation box<a class="self-link" href="#ruby-annotation-box"></a></dfn>.
			(Corresponds to HTML/XHTML <code>&lt;rt></code> elements.) 
    <dt><dfn class="css" data-dfn-for="display" data-dfn-type="value" data-export id="valdef-display-ruby-base-container">ruby-base-container<a class="self-link" href="#valdef-display-ruby-base-container"></a></dfn> 
    <dd>Specifies that an element generates a <dfn data-dfn-for data-dfn-type="dfn" data-export data-lt="ruby base container box | ruby base container" id="ruby-base-container-box">ruby base container box<a class="self-link" href="#ruby-base-container-box"></a></dfn>.
			(Corresponds to XHTML <code>&lt;rbc></code> elements; generated as an anonymous box in HTML.) 
    <dt><dfn class="css" data-dfn-for="display" data-dfn-type="value" data-export id="valdef-display-ruby-text-container">ruby-text-container<a class="self-link" href="#valdef-display-ruby-text-container"></a></dfn> 
    <dd>Specifies that an element generates a <dfn data-dfn-for data-dfn-type="dfn" data-export data-lt="ruby annotation container box | ruby annotation container" id="ruby-annotation-container-box">ruby annotation container box<a class="self-link" href="#ruby-annotation-container-box"></a></dfn>.
			(Corresponds to HTML/XHTML <code>&lt;rtc></code> elements.) 
   </dl>
   <p class="advisement">Authors using a language (such as HTML)
	that supports dedicated ruby markup
	should use that markup rather than
	styling arbitrary elements (like <code>&lt;span></code>)
	with ruby <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display④">display</a> values.
	Using the correct markup ensures that screen readers
	and non-CSS renderers can interpret the ruby structures. </p>
   <h4 class="heading settled" data-level="2.1.1" id="formatting-context"><span class="secno">2.1.1. </span><span class="content"> The Ruby Formatting Context</span><a class="self-link" href="#formatting-context"></a></h4>
   <p><i>Ruby containers</i> are non-atomic inline-level boxes.
	Like inline boxes, they break across lines,
	and their containing block is the nearest block container ancestor.
	And just as the contents of an inline box
	participate in the same inline formatting context that contains the inline box itself,
	a <i>ruby container</i> and its base-level contents
	participate in the same inline formatting context that contains the <i>ruby container</i> itself. </p>
   <p>However <i>ruby containers</i> also establish a <dfn data-dfn-type="dfn" data-export id="ruby-formatting-context">ruby formatting context<a class="self-link" href="#ruby-formatting-context"></a></dfn> that builds further structure around their segment of the inline formatting context. <i>Ruby bases</i>, <i>ruby annotations</i>, <i>ruby base containers</i>, and <i>ruby annotation containers</i> are <dfn data-dfn-type="dfn" data-export data-lt="internal ruby boxes|internal ruby display types" id="internal-ruby-boxes">internal ruby boxes<a class="self-link" href="#internal-ruby-boxes"></a></dfn>:
	like <i>internal table elements</i>,
	they have specific roles in ruby layout,
	and participate in their <i>ruby container</i>’s <i>ruby formatting context</i>. </p>
   <p>As with the contents of inline boxes,
	the containing block for the contents of a <i>ruby container</i> (and all its <i>internal ruby boxes</i>)
	is the containing block of the <i>ruby container</i>.
	So floats, for example, are trapped by the <i>ruby container</i>’s containing block,
	not any of the ruby box types. </p>
   <p class="issue" id="issue-ca88244c"><a class="self-link" href="#issue-ca88244c"></a>Are internal ruby boxes inline-level? </p>
   <h4 class="heading settled" data-level="2.1.2" id="block-ruby"><span class="secno">2.1.2. </span><span class="content"> Non-Inline Ruby</span><a class="self-link" href="#block-ruby"></a></h4>
   <p>If an element has an <i>inner display type</i> of <a class="css" data-link-type="maybe" href="#valdef-display-ruby" id="ref-for-valdef-display-ruby">ruby</a> and an <i>outer display type</i> other than <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-display-3/#valdef-display-inline" id="ref-for-valdef-display-inline">inline</a>,
	then it generates two boxes:
	a principal box of the required <i>outer display type</i> type,
	and an inline-level <i>ruby container</i>.
	All properties specified on the element apply to the principal box
	(and if inheritable, inherit to the <i>ruby container box</i>).
	This allows styling the element as a block,
	while correctly maintaining the internal ruby structure. </p>
   <p class="note" role="note"> Note that absolute positioning or floating an element causes its <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display⑤">display</a> value
	to compute to a block-level equivalent. (See <a data-link-type="biblio" href="#biblio-css-display-3">[CSS-DISPLAY-3]</a> or <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> section 9.7.)
	For the <i>internal ruby display types</i>,
	this causes their <span class="property" id="ref-for-propdef-display⑥">display</span> value to compute to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-display-3/#valdef-display-block" id="ref-for-valdef-display-block">block</a>. </p>
   <h3 class="heading settled" data-level="2.2" id="box-fixup"><span class="secno">2.2. </span><span class="content"> Anonymous Ruby Box Generation</span><a class="self-link" href="#box-fixup"></a></h3>
   <p>The CSS model does not require that the document language
	include elements that correspond to each of these components.
	Missing parts of the structure are implied through the anonymous box generation rules <a href="https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes">similar to those used to normalize tables</a>. <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> </p>
   <ol>
    <li id="anon-gen-inlinize"><a class="self-link" href="#anon-gen-inlinize"></a><strong><a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#inlinify" id="ref-for-inlinify">Inlinify</a> block-level boxes:</strong> Any in-flow boxes directly contained by a <i>ruby container</i>, <i>ruby base container</i>, <i>ruby annotation container</i>, <i>ruby base box</i>,
			or <i>ruby annotation box</i> are “<a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#inlinify" id="ref-for-inlinify①">inlinified</a>” per <a data-link-type="biblio" href="#biblio-css-display-3">[CSS-DISPLAY-3]</a>),
			and their <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display⑦">display</a> value computed accordingly,
			so that they contain only inline-level content.
			For example,
			the <span class="property" id="ref-for-propdef-display⑧">display</span> property of an in-flow element with <span class="css" id="ref-for-propdef-display⑨">display: block</span> parented by an element with <span class="css" id="ref-for-propdef-display①⓪">display: ruby-text</span> computes to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-display-3/#valdef-display-inline-block" id="ref-for-valdef-display-inline-block">inline-block</a>. 
    <li id="anon-gen-anon-ruby">
     <a class="self-link" href="#anon-gen-anon-ruby"></a><strong>Generate anonymous ruby containers</strong>:
			Any <a href="https://www.w3.org/TR/CSS2/tables.html#anonymous-boxes">consecutive</a> sequence of
			improperly-contained <i>ruby base containers</i>, <i>ruby annotation containers</i>, <i>ruby bases</i>,
			and/or <i>ruby annotations</i> (and any intervening <i>white space</i>)
			is wrapped in an anonymous <i>ruby container</i>.
			For the purpose of this step: 
     <ul>
      <li>an improperly-contained <i>ruby base</i> is one not parented by a <i>ruby base container</i> or <i>ruby container</i> 
      <li>an improperly-contained <i>ruby annotation</i> is one not parented by a <i>ruby annotation container</i> or <i>ruby container</i> 
      <li>an improperly-contained <i>ruby base container</i> or <i>ruby annotation container</i> is one not parented by a <i>ruby container</i> 
     </ul>
    <li id="anon-gen-bare-inlines">
     <a class="self-link" href="#anon-gen-bare-inlines"></a><strong>Wrap misparented inline-level content:</strong> Any consecutive sequence of text and inline-level boxes
			directly parented by a <i>ruby container</i> or <i>ruby base container</i> is wrapped in an anonymous <i>ruby base</i>.
			Similarly, any consecutive sequence of text and inline-level boxes
			directly parented by a <i>ruby annotation container</i> is wrapped in an anonymous <i>ruby annotation</i>.
			(For this purpose, misparented <i>internal table elements</i> are treated as <a data-link-type="dfn" href="https://drafts.csswg.org/css-display-3/#inline-level" id="ref-for-inline-level">inline-level content</a> since, being parented by ruby boxes,
			they will be ultimately wrapped by an <a data-link-type="dfn">inline table</a>.) 
     <p>However, if an anonymous box so constructed contains only <i>white space</i>,
			it is considered <dfn data-dfn-type="dfn" data-noexport id="intra-ruby-white-space">intra-ruby white space<a class="self-link" href="#intra-ruby-white-space"></a></dfn> and is either discarded
			or preserved
			as described below.</p>
    <li id="anony-gen-trim-space"><a class="self-link" href="#anony-gen-trim-space"></a><strong>Trim leading/trailing white space:</strong> Any <i>intra-ruby white space</i> that is not the sole child of its parent
			and occurs at the beginning or end of
			a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i> is removed, as if it had <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display①①">display: none</a> 
    <li id="anon-gen-discard-space">
     <a class="self-link" href="#anon-gen-discard-space"></a><strong>Remove inter-level white space:</strong> Any <i>intra-ruby white space</i> whose immediately adjacent siblings match one of the patterns below
			is <dfn data-dfn-type="dfn" data-noexport id="inter-level-white-space">inter-level white space<a class="self-link" href="#inter-level-white-space"></a></dfn> and is removed, as if it had <a class="css" data-link-type="propdesc" href="https://drafts.csswg.org/css-display-3/#propdef-display" id="ref-for-propdef-display①②">display: none</a>. 
     <table class="data">
      <thead>
       <tr>
        <th>Previous box 
        <th>Next box 
      <tbody>
       <tr>
        <td><var>any</var> 
        <td><i>ruby annotation container</i> 
       <tr>
        <td>not <i>ruby annotation</i> 
        <td><i>ruby annotation</i> 
     </table>
    <li id="anon-gen-interpret-space">
     <a class="self-link" href="#anon-gen-interpret-space"></a><strong>Interpret intra-level white space:</strong> Any <i>intra-ruby white space</i> box
			whose immediately adjacent siblings match one of the patterns below
			is assigned the box type and subtype defined in the table below: 
     <table class="data">
      <colgroup span="2">
      <colgroup span="2">
      <thead>
       <tr>
        <th>Previous box 
        <th>Next box 
        <th>Box type 
        <th>Subtype 
      <tbody>
       <tr>
        <td><i>ruby base</i> 
        <td><i>ruby base</i> 
        <td><i>ruby base</i> 
        <td><dfn data-dfn-type="dfn" data-noexport id="inter-base-white-space">inter-base white space<a class="self-link" href="#inter-base-white-space"></a></dfn> 
       <tr>
        <td><i>ruby annotation</i> 
        <td><i>ruby annotation</i> 
        <td><i>ruby annotation</i> 
        <td><dfn data-dfn-type="dfn" data-noexport id="inter-annotation-white-space">inter-annotation white space<a class="self-link" href="#inter-annotation-white-space"></a></dfn> 
       <tr>
        <td><i>ruby annotation</i> or <i>ruby annotation container</i> 
        <td><i>ruby base</i> or <i>ruby base container</i> 
        <td rowspan="3"><i>ruby base</i> 
        <td rowspan="3"><dfn data-dfn-type="dfn" data-noexport id="inter-segment-white-space">inter-segment white space<a class="self-link" href="#inter-segment-white-space"></a></dfn> 
       <tr>
        <td><i>ruby base</i> or <i>ruby base container</i> 
        <td><i>ruby base container</i> 
       <tr>
        <td><i>ruby base container</i> 
        <td><i>ruby base</i> or <i>ruby base container</i> 
     </table>
      The <dfn data-dfn-type="dfn" data-noexport id="intra-level-white-space">intra-level white space<a class="self-link" href="#intra-level-white-space"></a></dfn> boxes defined above are
			treated specially for pairing and layout. See below. 
    <li id="anon-gen-unbreak">
     <a class="self-link" href="#anon-gen-unbreak"></a><strong>Suppress line breaks:</strong> Convert all forced line breaks inside <i>ruby annotations</i> (regardless of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-4/#propdef-white-space" id="ref-for-propdef-white-space">white-space</a> value)
			as defined for <i>collapsible</i> segment breaks in <a href="https://www.w3.org/TR/css-text-3/#line-break-transform">CSS Text Level 3 § 4.1.2</a>. 
     <p class="issue" id="issue-f0987196"><a class="self-link" href="#issue-f0987196"></a>The goal of this is to simplify the layout model by suppressing any line breaks within ruby annotations.
			Alternatively we could try to define some kind of acceptable behavior for them. </p>
    <li id="anon-gen-anon-containers"><a class="self-link" href="#anon-gen-anon-containers"></a><strong>Generate anonymous level containers:</strong> Any consecutive sequence of <i>ruby bases</i> and <i>inter-base white space</i> (and not <i>inter-segment white space</i>)
			not parented by a <i>ruby base container</i> is wrapped in an anonymous <i>ruby base container</i>.
			Similarly, any consecutive sequence of <i>ruby annotations</i> and <i>inter-annotation white space</i> not parented by a <i>ruby annotation container</i> is wrapped in an anonymous <i>ruby annotation container</i>. 
   </ol>
   <p class="issue" id="issue-dfd9c615"><a class="self-link" href="#issue-dfd9c615"></a>Make <a href="http://lists.w3.org/Archives/Public/www-archive/2014Jun/att-0027/PastedGraphic-1.png">this diagram</a> into an example. </p>
   <p>Once all ruby layout structures are properly parented,
	the UA can start to associate bases with their annotations. </p>
   <p class="note" role="note"> Note that the UA is not required to create any of these anonymous boxes
	(or the anonymous empty <i>intra-level white space</i> boxes in the pairing section)
	in its internal structures,
	as long as pairing and layout behaves as if they existed. </p>
   <h3 class="heading settled" data-level="2.3" id="ruby-pairing"><span class="secno">2.3. </span><span class="content"> Annotation Pairing</span><a class="self-link" href="#ruby-pairing"></a></h3>
   <p>Annotation <dfn data-dfn-type="dfn" data-noexport id="pairing">pairing<a class="self-link" href="#pairing"></a></dfn> is the process of associating <i>ruby annotations</i> with <i>ruby bases</i>.
	Each <i>ruby annotation</i> is associated with one or more <i>ruby bases</i>,
	and is said to <dfn data-dfn-type="dfn" data-noexport id="span">span<a class="self-link" href="#span"></a></dfn> those bases.
	(A <i>ruby annotation</i> that <i>spans</i> multiple bases is called
	a <dfn data-dfn-type="dfn" data-noexport id="spanning-annotation">spanning annotation<a class="self-link" href="#spanning-annotation"></a></dfn>.) </p>
   <p>A <i>ruby base</i> is can be associated with
	only one <i>ruby annotation</i> per <i>annotation level</i>.
	However, if there are multiple <i>annotation levels</i>,
	it can be associated with multiple <i>ruby annotations</i>.</p>
   <p>Once pairing is complete, ruby “column” units are defined,
	each represented by a single <i>ruby base</i> and one <i>ruby annotation</i> (possibly an empty, anonymous one)
	from each <i>annotation level</i> in its <i>ruby segment</i>.</p>
   <h4 class="heading settled" data-level="2.3.1" id="segment-pairing"><span class="secno">2.3.1. </span><span class="content"> Segment Pairing and Annotation Levels</span><a class="self-link" href="#segment-pairing"></a></h4>
   <p>A ruby structure is divided into <dfn data-dfn-type="dfn" data-noexport id="ruby-segments">ruby segments<a class="self-link" href="#ruby-segments"></a></dfn>,
	each consisting of a single <i>ruby base container</i> followed by one or more <i>ruby annotation containers</i>.
	Each <i>ruby annotation container</i> in a <i>ruby segment</i> represents one <dfn data-dfn-type="dfn" data-lt="annotation level | level" data-noexport id="annotation-level">level<a class="self-link" href="#annotation-level"></a></dfn> of annotation for the base text:
	the first one represents the first level of annotation,
	the second one represents the second level of annotation,
	and so on.
	The <i>ruby base container</i> represents the <dfn data-dfn-type="dfn" data-noexport id="base-level">base level<a class="self-link" href="#base-level"></a></dfn>.
	The <i>ruby base container</i> in each segment is thus paired
	with each of the <i>ruby annotation containers</i> in that segment. </p>
   <p>In order to handle degenerate cases, some empty anonymous containers are assumed: </p>
   <ul>
    <li>If the first child of a <i>ruby container</i> is a <i>ruby annotation container</i>,
		an anonymous, empty <i>ruby base container</i> is assumed to exist before it. 
    <li>Similarly, if the <i>ruby container</i> contains consecutive <i>ruby base containers</i>,
		anonymous, empty <i>ruby annotation containers</i> are assumed to exist between them. 
   </ul>
   <p><i>Inter-segment white space</i> is effectively a <i>ruby segment</i> of its own. </p>
   <h4 class="heading settled" data-level="2.3.2" id="base-annotation-pairing"><span class="secno">2.3.2. </span><span class="content"> Unit Pairing and Spanning Annotations</span><a class="self-link" href="#base-annotation-pairing"></a></h4>
   <p>Within a <i>ruby segment</i>,
	each <i>ruby base</i> in the <i>ruby base container</i> is paired with one <i>ruby annotation</i> from each <i>ruby annotation container</i> in its <i>ruby segment</i>. </p>
   <p>If a <i>ruby annotation container</i> contains only
	a single, anonymous <i>ruby annotation</i>,
	then that <i>ruby annotation</i> is paired with (i.e. <i>spans</i> across)
	all of the <i>ruby bases</i> in its <i>ruby segment</i>. </p>
   <p>Otherwise, each <i>ruby annotation</i> is paired,
	in order, with the corresponding <i>ruby base</i> in that segment.
	If there are not enough <i>ruby annotations</i> in a <i>ruby annotation container</i>,
	the remaining <i>ruby bases</i> are paired with anonymous empty annotations
	inserted at the end of the <i>ruby annotation container</i>.
	If there are not enough <i>ruby bases</i>,
	any remaining <i>ruby annotations</i> pair with empty, anonymous bases
	inserted at the end of the <i>ruby base container</i>. </p>
   <p>If an implementation supports ruby markup with explicit spanning
	(e.g. XHTML Complex Ruby Annotations),
	it must adjust the pairing rules to pair <i>spanning annotations</i> to their bases appropriately. </p>
   <p><i>Intra-level white space</i> does not participate in standard annotation <i>pairing</i>.
	However, if the immediately-adjacent <i>ruby bases</i> or <i>ruby annotations</i> are paired </p>
   <ul>
    <li>with two <i>ruby bases</i> or <i data-lt="ruby annotations">annotations</i> that surround corresponding <i>intra-level white space</i> in another level,
		then the so-corresponding <i>intra-level white space</i> boxes are also paired. 
    <li>with a single spanning <i>ruby annotation</i>,
		then the <i>intra-level white space</i> is also paired to that <i>ruby annotation</i> 
    <li>with two <i>ruby bases</i> or <i data-lt="ruby annotations">annotations</i> with no intervening <i>intra-level white space</i>,
		then the <i>intra-level white space</i> box pairs with
		an anonymous empty <i>intra-level white space</i> box assumed to exist between them. 
   </ul>
   <p class="issue" id="issue-0230a91a"><a class="self-link" href="#issue-0230a91a"></a>Insert diagram</p>
   <h4 class="heading settled" data-level="2.3.3" id="nested-pairing"><span class="secno">2.3.3. </span><span class="content"> Complex Spanning with Nested Ruby</span><a class="self-link" href="#nested-pairing"></a></h4>
   <p>When <i>ruby containers</i> are <dfn data-dfn-type="dfn" data-lt="nested ruby" data-noexport id="nested-ruby">nested<a class="self-link" href="#nested-ruby"></a></dfn>,
	pairing begins with the deepest <i>ruby container</i>,
	then expands out.
	From the pairing perspective of the outer <i>ruby container</i>,
	each <i>ruby container</i> nested within another <i>ruby container</i> counts as representing a single <i>ruby base</i>/<i>annotation</i> per level.
	The outer <i>ruby container</i>’s <i>ruby annotations</i> paired to the <i>nested ruby</i> are therefore paired with (and <i>span</i>) all of the nested <i>ruby container</i>’s <i>ruby bases</i>.
	Each <i>ruby annotation container</i> in the nested <i>ruby container</i> occupies the same <i>annotation level</i> in the outer <i>ruby container</i> as it does in the inner one
	and participates in its layout as if it were directly contained in the outer <i>ruby container</i>. </p>
   <p>This process is recursive.
	Thus, using nested <i>ruby containers</i> allows the representation
	of complex spanning relationships. </p>
   <p class="issue" id="issue-ec2866e8"><a class="self-link" href="#issue-ec2866e8"></a>It’s not clear whether this falls out of layout handling of ruby containers inside ruby bases
	or needs to be handled specially.
	Waiting until layout is better-defined to find out... </p>
   <h3 class="heading settled" data-level="2.4" id="autohide"><span class="secno">2.4. </span><span class="content"> Autohiding Base-identical Annotations</span><a class="self-link" href="#autohide"></a></h3>
   <p>If a <i>ruby annotation</i> has the exact same text content as its base,
	it is <dfn data-dfn-type="dfn" data-lt="hidden ruby annotation | hidden annotation" data-noexport id="hidden-ruby-annotation">hidden<a class="self-link" href="#hidden-ruby-annotation"></a></dfn>.
	Hiding a <i>ruby annotation</i> does not affect annotation pairing
	or the block-axis positioning of boxes in other <i>levels</i>.
	However the <i>hidden annotation</i> is not visible,
	and it has no impact on layout
	other than to separate adjacent sequences of <i>ruby annotation boxes</i> within its level,
	as if they belonged to separate segments
	and the <i>hidden annotation</i>’s base were not a <i>ruby base</i> but an intervening inline. </p>
   <div class="example" id="example-775b2890">
    <a class="self-link" href="#example-775b2890"></a> 
    <p>This is to allow correct inlined display of annotations
		for Japanese words that are a mix of kanji and hiragana.
		For example, the word <span lang="ja">振り仮名</span> should be inlined as </p>
    <p class="figure">振り仮名(ふりがな) </p>
    <p>and therefore marked up as </p>
<pre>&lt;ruby>
  &lt;rb>振&lt;/rb>&lt;rb>り&lt;/rb>&lt;rb>仮&lt;/rb>&lt;rb>名&lt;/rb>
  &lt;rp>(&lt;/rp>&lt;rt>ふ&lt;/rt>&lt;rt>り&lt;/rt>&lt;rt>が&lt;/rt>&lt;rt>な&lt;/rt>&lt;rp>)&lt;/rp>
&lt;/ruby></pre>
    <p>However, when displayed as ruby, the “り” should be hidden </p>
    <div class="figure">
     <p><img alt="Hiragana annotations for 振り仮名 appear, each pronunciation above its kanji base character." src="images/furigana-separate.png"> </p>
     <p class="caption">Hiragana ruby for 振り仮名. Notice there is no hiragana annotation above り,  since it is already in hiragana. </p>
    </div>
   </div>
   <p>When the computed value of <a class="property" data-link-type="propdesc" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge">ruby-merge</a> is <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-collapse" id="ref-for-valdef-ruby-merge-collapse">collapse</a>,
	the autohiding is disabled.
	When the computed value of <span class="property" id="ref-for-propdef-ruby-merge①">ruby-merge</span> is <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-auto" id="ref-for-valdef-ruby-merge-auto">auto</a>,
	the user agent may decide whether to autohide or not,
	but it is recommended to autohide if the algorithm the user agent chose
	produces the results similar to <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-separate" id="ref-for-valdef-ruby-merge-separate">separate</a> would produce. </p>
   <p>The content comparison for this auto-hiding behavior
	takes place prior to white space collapsing (<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-4/#propdef-white-space" id="ref-for-propdef-white-space①">white-space</a>) and text transformation (<a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-transform" id="ref-for-propdef-text-transform">text-transform</a>)
	and ignores elements (considers only the <code>textContent</code> of the boxes). </p>
   <p class="note" role="note"> Future levels of CSS Ruby may add controls for auto-hiding,
		but in this level it is always forced. </p>
   <h3 class="heading settled" data-level="2.5" id="white-space"><span class="secno">2.5. </span><span class="content"> White Space Collapsing</span><a class="self-link" href="#white-space"></a></h3>
   <p>White space within a ruby structure is <a href="#anon-gen-discard-space">discarded</a> </p>
   <ul>
    <li>at the beginning and end of a <i>ruby container</i>, <i>ruby annotation container</i>, or <i>ruby base container</i>, 
    <li>between a <i>ruby base container</i> and its following <i>ruby annotation container</i>, 
    <li>between <i>ruby annotation containers</i>. 
   </ul>
   <div class="example" id="example-abf396f5">
    <a class="self-link" href="#example-abf396f5"></a> For example, the following markup will display without any spaces: 
<pre>&lt;ruby>
  &lt;rb>東&lt;/rb>&lt;rb>京&lt;/rb>
  &lt;rt>とう&lt;/rt>&lt;rt>きょう&lt;/rt>
  &lt;rt>Tō&lt;/rt>&lt;rt>kyō&lt;/rt>
&lt;/ruby></pre>
   </div>
   <p>Between <i>ruby segments</i>, between <i>ruby bases</i>, and between <i>ruby annotations</i>, however,
	white space is not discarded,
	and is maintained for rendering
	as <i data-lt="inter-base white space">inter-base</i>, <i data-lt="inter-annotation white space">inter-annotation</i>,
	or <i>inter-segment white space</i>.
	(See <a href="#box-fixup">Anonymous Ruby Box Generation</a>, above.) </p>
   <div class="example" id="example-4ae8c97c">
    <a class="self-link" href="#example-4ae8c97c"></a> 
    <p>The rules preserving white space allow ruby to be used with space-separated scripts such as Latin.
		For example, </p>
<pre>&lt;ruby>
  &lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>
  &lt;rt>World&lt;/rt> &lt;rt>Wide&lt;/rt> &lt;rt>Web&lt;/rt>
&lt;/ruby></pre>
    <p>They also ensure that annotated white space is preserved. For example, </p>
<pre>&lt;ruby>
  &lt;rb>Aerith&lt;/rb>&lt;rb> &lt;/rb>&lt;rb>Gainsboro&lt;/rb>
  &lt;rt>エアリス&lt;/rt>&lt;rt>・&lt;/rt>&lt;rt>ゲインズブール&lt;/rt>
&lt;/ruby></pre>
   </div>
   <p>Where undiscarded white space is <i>collapsible</i>, it will collapse
	following the standard <a href="https://www.w3.org/TR/css3-text/#white-space-rules">white space processing rules</a>. <a data-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a> For <i>collapsible white space</i> between <i>ruby segments</i> (<i>inter-segment white space</i>), however,
	the contextual text for determining collapsing behavior is given by the <i>ruby bases</i> on either side,
	not the text on either side of the white space in source document order. </p>
   <div class="note" role="note">
    <p>Note that the white space processing rules
		cause a white space sequence containing a <i>segment break</i> (such as a line feed)
		to <a href="https://www.w3.org/TR/css3-text/#line-break-transform">collapse to nothing</a> between Han and Kana characters.
		This means that Chinese and Japanese ruby can safely use white space for indentation of ruby markup.
		For example, the following markup will display without any spaces: </p>
<pre>&lt;ruby>
  屋&lt;rt>おく&lt;/rt>内&lt;rt>ない&lt;/rt>
  禁&lt;rt>きん&lt;/rt>煙&lt;rt>えん&lt;/rt>
&lt;/ruby></pre>
    <p>However, white space that does not contain a <i>segment break</i> does not collapse completely away,
		so this markup will display with a space between the first and second ruby pairs: </p>
<pre>&lt;ruby>
  屋&lt;rt>おく&lt;/rt>  内&lt;rt>ない&lt;/rt>
  禁&lt;rt>きん&lt;/rt>  煙&lt;rt>えん&lt;/rt>
&lt;/ruby></pre>
   </div>
   <h2 class="heading settled" data-level="3" id="ruby-layout"><span class="secno">3. </span><span class="content"> Ruby Layout</span><a class="self-link" href="#ruby-layout"></a></h2>
   <p>When a ruby structure is laid out,
	its <i>base level</i> is laid out on the line,
	aligned according to its <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-inline-3/#propdef-vertical-align" id="ref-for-propdef-vertical-align">vertical-align</a> property
	exactly as if its <i>ruby bases</i> were a regular sequence of inline boxes.
	Each <i>ruby base container</i> is sized and positioned
	to contain exactly all of its <i>ruby bases</i>’ margin boxes. </p>
   <p><i>Ruby annotations</i> associated with the <i>base level</i> are then positioned with respect to their <i>ruby base boxes</i> according to the applicable <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position①">ruby-position</a> values. <i>Ruby annotations</i> within a level (within a single <i>ruby container</i>)
	are aligned to each other as if they were inline boxes
	participating in the same inline formatting context.
	Each <i>ruby annotation container</i> is sized and positioned
	to contain exactly all of its <i>ruby annotations</i>’ margin boxes. </p>
   <p><i>Ruby annotation containers</i> are stacked outward
	over or under their corresponding <i>ruby base container</i>,
	without any intervening space. </p>
   <p class="issue" id="issue-ea5c17b0"><a class="self-link" href="#issue-ea5c17b0"></a>Should block-axis margins collapse?
	This makes layout more robust,
	but is inconsistent with how inlines behave along the inline-axis. </p>
   <p>A ruby container (or fragment thereof)
	measures as wide as the content of its widest level.
	Similarly, <i>ruby base boxes</i> and <i>ruby annotation boxes</i> within a ruby “column” have the measure of the widest content in that “column”.
	In the case of <i>spanning annotations</i> (whether actually spanning or pretending to span per <a class="property" data-link-type="propdesc" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge②">ruby-merge</a>),
	the measures of the <i>ruby annotation box</i> and
	the sum of its associated <i>ruby base boxes</i> must match. </p>
   <p>How the extra space is distributed
	when ruby content is narrower than the measure of its box
	is specified by the <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align">ruby-align</a> property. </p>
   <p class="issue" id="issue-cc873b76"><a class="self-link" href="#issue-cc873b76"></a>Should the ruby bases and annotations size to the column,
	or size to the content? </p>
   <h3 class="heading settled" data-level="3.1" id="inter-character-layout"><span class="secno">3.1. </span><span class="content"> Inter-character Ruby Layout</span><a class="self-link" href="#inter-character-layout"></a></h3>
   <p>Inter-character annotations have special layout.
	When <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position②">ruby-position</a> indicates <a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character">inter-character</a> annotations,
	the affected <i>ruby annotation boxes</i> are spliced into and measured as part of the layout of the <i>base level</i>.
	The <i>ruby base container</i> must be sized to include both the <i>ruby base boxes</i> as well as the <span class="css" id="ref-for-valdef-ruby-position-inter-character①">inter-character</span> <i>ruby annotation boxes</i>.
	The affected <i>ruby annotation container</i> is similarly sized
	so that its content box coincides with that of the <i>ruby base container</i>. </p>
   <p>For the purpose of laying out other levels of annotations,
	an <a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character②">inter-character</a> annotation effectively becomes part of its base. <span class="issue" id="issue-029133da"><a class="self-link" href="#issue-029133da"></a>Or should it become a quasi-base between two bases?</span> A spanning <span class="css" id="ref-for-valdef-ruby-position-inter-character③">inter-character</span> annotation is placed after
	all the bases that it spans. </p>
   <h3 class="heading settled" data-level="3.2" id="box-style"><span class="secno">3.2. </span><span class="content"> Styling Ruby Boxes</span><a class="self-link" href="#box-style"></a></h3>
   <p>In most respects, ruby boxes can be styled similar to inline boxes.
	However, the UA is not required to support
	any of the box properties (borders, margins, padding),
	any of the background properties or outline properties,
	or any other property that illustrates the bounds of the box
	on <i>ruby base container boxes</i>, <i>ruby annotation container boxes</i>,
	or <a href="#nested-pairing">ruby-internal ruby container boxes</a>.
	The UA may implement these boxes simply as abstractions for inheritance
	and control over the layout of their contents. </p>
   <h3 class="heading settled" data-level="3.3" id="line-breaks"><span class="secno">3.3. </span><span class="content"> Breaking Across Lines</span><a class="self-link" href="#line-breaks"></a></h3>
   <p>When there is not enough space for an entire <i>ruby container</i> to fit on the line,
	the ruby may be broken wherever all levels simultaneously allow a break.
	Ruby most often breaks between base-annotation sets,
	but if the line-breaking rules allow it, can also break within a <i>ruby base</i> (and, in parallel, its associated <i>ruby annotation boxes</i>). </p>
   <p>Whenever ruby breaks across lines, <i>ruby annotations</i> must stay
	with their respective <i>ruby bases</i>.
	The line <em>must not</em> break between a <i>ruby base</i> and its <i>annotations</i>,
	even in the case of <a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character④">inter-character</a> <i>annotations</i>. </p>
   <div class="figure">
     <img alt="Diagram showing the line breaking opportunity in a &quot;Bopomofo&quot; ruby" src="images/r-break-b.gif"> 
    <p class="caption"><a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character⑤">inter-character</a> ruby line breaking opportunity </p>
   </div>
   <h4 class="heading settled" data-level="3.3.1" id="break-between"><span class="secno">3.3.1. </span><span class="content"> Breaking Between Bases</span><a class="self-link" href="#break-between"></a></h4>
   <p>In typical cases, <i>ruby base boxes</i> and <i>ruby annotation boxes</i> are styled to forbid internal line wrapping and do not contain forced breaks.
	(See <a href="#default-stylesheet">Appendix A</a>.)
	In such cases the <i>ruby container</i> can only break between adjacent <i>ruby bases</i>,
	and only if no <i>ruby annotations</i> span those <i>ruby bases</i>. </p>
   <div class="figure">
    <p><img alt="Diagram showing the line breaking opportunity in a complex ruby" src="images/r-break-a.gif"> </p>
    <p class="caption">Ruby line breaking opportunity </p>
   </div>
   <p>Whether ruby can break between two adjacent <i>ruby bases</i> is controlled by normal line-breaking rules for the base text,
	exactly as if the <i>ruby bases</i> were adjacent inline boxes.
	(The annotations are ignored when determining soft wrap opportunities for the <i>base level</i>.) </p>
   <div class="example" id="example-9780a5d8">
    <a class="self-link" href="#example-9780a5d8"></a> 
    <p>For example, if two adjacent ruby bases are “蝴” and “蝶”,
		the line may break between them,
		because lines are normally allowed to break between two Han characters.
		However, if <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-word-break" id="ref-for-propdef-word-break">word-break</a> is <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-text-3/#valdef-word-break-keep-all" id="ref-for-valdef-word-break-keep-all">keep-all</a>, that line break is forbidden. </p>
<pre>&lt;ruby>蝴&lt;rt>hú&lt;/rt>蝶&lt;rt>dié&lt;/rt></pre>
   </div>
   <p>Inter-base white space is significant for evaluating line break opportunities between <i>ruby bases</i>.
	As with white space between inlines, it collapses when the line breaks there.
	Similarly, annotation white space is also trimmed at a line break. </p>
   <div class="example" id="example-79694ff5">
    <a class="self-link" href="#example-79694ff5"></a> 
    <p>For example, given the following markup: </p>
<pre>&lt;ruby>&lt;rb>one&lt;/rb> &lt;rb>two&lt;/rb> &lt;rt>1&lt;/rt> &lt;rt>2&lt;/rt>&lt;/ruby></pre>
    <p>Due to the space, the line may break between “one” and “two“.
		If the line breaks there, that space—and the space between “1” and “2”—disappears,
		in accordance with standard CSS white space processing rules. <a data-link-type="biblio" href="#biblio-css3text">[CSS3TEXT]</a> </p>
   </div>
   <h4 class="heading settled" data-level="3.3.2" id="break-within"><span class="secno">3.3.2. </span><span class="content"> Breaking Within Bases</span><a class="self-link" href="#break-within"></a></h4>
   <p>For longer base texts, it is sometimes appropriate to allow breaking within a base-annotation pair.
	For example, if an English sentence is annotated with its Japanese translation,
	allowing the text to wrap allows for reasonable line breaking behavior in the paragraph. </p>
   <p class="issue" id="issue-14d7c6b1"><a class="self-link" href="#issue-14d7c6b1"></a> Insert scanned example so people don’t think this is just the ramblings of an insane spec-writer. </p>
   <p>Line-breaking within a <i>ruby base</i> is only allowed if the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-4/#propdef-white-space" id="ref-for-propdef-white-space②">white-space</a> property
	of the <i>ruby base</i> and all its parallel <i>annotations</i> allow it,
	and there exists a <i>soft wrap opportunity</i> <em>within</em> (i.e. not at the start or end)
	the content of each base/annotation box.
	Since there is no structural correspondence between fragments of content
	within <i>ruby bases</i> and <i>annotations</i>,
	the UA may break at any set of opportunities;
	but it is recommended that the UA attempt to proportionally balance
	the amount of content inside each fragment. </p>
   <p>There are no line breaking opportunities within <a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character⑥">inter-character</a> <i>annotations</i>. </p>
   <p>Ruby alignment takes place within each fragment, after line-breaking. </p>
   <h3 class="heading settled" data-level="3.4" id="bidi"><span class="secno">3.4. </span><span class="content"> Bidi Reordering</span><a class="self-link" href="#bidi"></a></h3>
   <p>The Unicode bidirectional algorithm reorders logically-stored text for visual presentation
	when characters from scripts of opposing directionalities are mixed
	within a single paragraph. </p>
   <p>To preserve the correspondance of <i>ruby annotations</i> to their respective <i>ruby bases</i>,
	a few restrictions must be imposed: </p>
   <ul>
    <li>The contents of a <i>ruby base</i> or <i>ruby annotation</i> must remain contiguous. 
    <li><i>Ruby annotations</i> must be reordered together with their <i>ruby bases</i>. 
    <li>All <i>ruby bases</i> spanned by a single <i>ruby annotation</i> must remain contiguous. 
   </ul>
   <p>To this end, </p>
   <ul>
    <li>
      Bidi isolation is forced on all <i>internal ruby boxes</i> and the <i>ruby container</i>:
			the <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-normal" id="ref-for-valdef-unicode-bidi-normal">normal</a> and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-embed" id="ref-for-valdef-unicode-bidi-embed">embed</a> values of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi" id="ref-for-propdef-unicode-bidi">unicode-bidi</a> compute to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate" id="ref-for-valdef-unicode-bidi-isolate">isolate</a>,
			and <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-bidi-override" id="ref-for-valdef-unicode-bidi-bidi-override">bidi-override</a> computes to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate-override" id="ref-for-valdef-unicode-bidi-isolate-override">isolate-override</a>. 
     <p class="note" role="note"> Note this means that implicit bidi reordering does not work across ruby bases,
				so authors will need to ensure that the <i>ruby container</i>’s declared directionality
				does indeed match its contents. </p>
    <li> During layout, <i>ruby segments</i> are ordered within the <i>ruby container</i> by the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction">direction</a> property of their <i>ruby container</i>. 
    <li> Within a segment, <i>ruby bases</i> and <i>ruby annotations</i> are ordered within their respective containers
			by the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction①">direction</a> property of the segment’s <i>ruby base container</i>. <span class="note"> Note this means the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction" id="ref-for-propdef-direction②">direction</a> property on <i>ruby annotation containers</i> is ignored for the purpose of layout.
				However, it can still inherit into the container’s children
				and thereby affect the <i>inline base direction</i> of any <i>ruby annotations</i> it contains. </span> 
   </ul>
   <p>As with other inline-level content,
	the bidi reordering of <i>internal ruby boxes</i> happens after line-breaking
	so that content is divided across lines according to its logical order. </p>
   <p>See <a data-link-type="biblio" href="#biblio-css3-writing-modes">[CSS3-WRITING-MODES]</a> for a more in-depth discussion of bidirectional text in CSS. </p>
   <h3 class="heading settled" data-level="3.5" id="line-height"><span class="secno">3.5. </span><span class="content"> Line Spacing</span><a class="self-link" href="#line-height"></a></h3>
   <p>The <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height" id="ref-for-propdef-line-height">line-height</a> property controls spacing between lines in CSS.
	When inline content on line is shorter than the <span class="property" id="ref-for-propdef-line-height①">line-height</span>,
	half-leading is added on either side of the content,
	as specified in <a href="https://www.w3.org/TR/CSS2/visudet.html#line-height">CSS2.1§10.8</a>. <a data-link-type="biblio" href="#biblio-css2">[CSS2]</a> </p>
   <p>In order to ensure consistent spacing of lines,
	documents with ruby typically ensure that the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height" id="ref-for-propdef-line-height②">line-height</a> is large enough
	to accommodate ruby between lines of text.
	Therefore, ordinarily, <i>ruby annotation containers</i> and <i>ruby annotation boxes</i> do not contribute to the measured height of a line’s inline contents;
	any alignment (see <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-inline-3/#propdef-vertical-align" id="ref-for-propdef-vertical-align①">vertical-align</a>) and line-height calculations
	are performed using only the <i>ruby base container</i>,
	exactly as if it were a normal inline. </p>
   <p>However, if the <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height" id="ref-for-propdef-line-height③">line-height</a> specified on the <i>ruby container</i> is less than the distance between
	the top of the top <i>ruby annotation container</i> and the bottom of the bottom <i>ruby annotation container</i>,
	then additional leading is added
	on the appropriate side of the <i>ruby base container</i> such that if a block consisted of three lines
	each containing ruby identical to this,
	none of the <i>ruby containers</i> would overlap. </p>
   <p class="note" role="note">Note that this does not ensure that the <i>ruby annotations</i> remain within the line box.
	It merely ensures that <em>if all lines had equal spacing</em> and equivalent amounts and positioning of <i>ruby annotations</i>,
	there would be enough room to avoid overlap. </p>
   <p>Authors should ensure appropriate <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height" id="ref-for-propdef-line-height④">line-height</a> and <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-box-3/#propdef-padding" id="ref-for-propdef-padding">padding</a> to accommodate ruby,
	and be particularly careful at the beginning or end of a block
	and when a line contains inline-level content
	(such as images, inline blocks, or elements shifted with <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-inline-3/#propdef-vertical-align" id="ref-for-propdef-vertical-align②">vertical-align</a>)
	taller than the paragraph’s default font size. </p>
   <div class="figure">
    <p><img alt="The content of each line sits in the middle of its line height;
		             the additional space on each side is called half-leading.
		             Ruby fits between lines if it is smaller than twice the half-leading,
		             but this means that it occupies space belonging to the half-leading of the previous line." src="images/rlh-a.gif"> </p>
    <p class="caption">Ruby annotations will often overflow the line;
		authors should ensure content over/under a ruby-annotated line
		is adequately spaced to leave room for the ruby. </p>
   </div>
   <p class="note" role="note">More control over how ruby affects alignment and line layout
	will be part of the CSS Line Layout Module Level 3.
	Note, it is currently in the process of being rewritten;
	the current drafts should not be relied upon. </p>
   <h2 class="heading settled" data-level="4" id="ruby-props"><span class="secno">4. </span><span class="content"> Ruby Formatting Properties</span><a class="self-link" href="#ruby-props"></a></h2>
   <p>The following properties are introduced to control ruby <a href="#rubypos">positioning</a>, <a href="#collapsed-ruby">text distribution</a>,
	and <a href="#rubyalign">alignment</a>. </p>
   <h3 class="heading settled" data-level="4.1" id="rubypos"><span class="secno">4.1. </span><span class="content"> Ruby Positioning: the <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position③">ruby-position</a> property</span><a class="self-link" href="#rubypos"></a></h3>
   <table class="def propdef" data-link-for-hint="ruby-position">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-ruby-position">ruby-position</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">over <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one④">|</a> under <span id="ref-for-comb-one⑤">|</span> inter-character 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>over 
     <tr>
      <th>Applies to:
      <td>ruby annotation containers 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>yes 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>n/a 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>specified keyword 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>discrete 
   </table>
   <p>This property controls position of the ruby text with respect to its base.
	Values have the following meanings: </p>
   <p class="issue" id="issue-99cf2a0d"><a class="self-link" href="#issue-99cf2a0d"></a><span class="issuehead">Issue-107: </span> Roland Steiner has requested the addition of an auto value as default. See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&amp;hdr-1-name=subject&amp;hdr-1-query=ruby-position%3A+undesirable+default+value+%27before%27+for+complex+ruby&amp;hdr-2-name=from&amp;hdr-2-query=&amp;hdr-3-name=message-id&amp;hdr-3-query=&amp;period_month=&amp;period_year=&amp;index-grp=Public__FULL&amp;index-type=t&amp;type-index=www-style&amp;resultsperpage=20&amp;sortby=date">this thread</a> and <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&amp;hdr-1-name=subject&amp;hdr-1-query=Styling+of+complex+Ruby&amp;hdr-2-name=from&amp;hdr-2-query=&amp;hdr-3-name=message-id&amp;hdr-3-query=&amp;period_month=&amp;period_year=&amp;index-grp=Public__FULL&amp;index-type=t&amp;type-index=public-i18n-core&amp;resultsperpage=20&amp;sortby=date">this one</a>. Current proposal is to add an optional <span class="css">alternate?</span> keyword.</p>
   <dl>
    <dt><dfn class="css" data-dfn-for="ruby-position" data-dfn-type="value" data-export id="valdef-ruby-position-over">over<a class="self-link" href="#valdef-ruby-position-over"></a></dfn> 
    <dd>
     The ruby text appears <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-4/#line-over" id="ref-for-line-over">line-over</a> the base. 
     <div class="figure">
      <p><img alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing above the base" src="images/shinkansen-top.gif"> </p>
      <p class="caption">Ruby over Japanese base text in horizontal layout </p>
     </div>
     <div class="figure">
      <p><img alt="Diagram of ruby glyph layout in vertical mode with ruby text appearing vertically on the right of the base" src="images/shinkansen-right.gif" width="33"> </p>
      <p class="caption">Ruby to the right of Japanese base text in vertical layout </p>
     </div>
    <dt><dfn class="css" data-dfn-for="ruby-position" data-dfn-type="value" data-export id="valdef-ruby-position-under">under<a class="self-link" href="#valdef-ruby-position-under"></a></dfn> 
    <dd>
     The ruby text appears <a data-link-type="dfn" href="https://drafts.csswg.org/css-writing-modes-4/#line-under" id="ref-for-line-under">line-under</a> the base.
			This is a relatively rare setting used in ideographic East Asian writing systems,
			most easily found in educational text. 
     <div class="figure">
      <p><img alt="Diagram of ruby glyph layout in horizontal mode with ruby text appearing below the base" src="images/shinkansen-bottom.gif"> </p>
      <p class="caption">Ruby under Japanese base text in horizontal layout </p>
     </div>
     <div class="figure">
      <p><img alt="Diagram of ruby glyph layout in vertical mode with ruby text appearing vertically on the left of the base" src="images/shinkansen-left.gif"> </p>
      <p class="caption">Ruby to the left of Japanese base text in vertical layout </p>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-position" data-dfn-type="value" data-export id="valdef-ruby-position-inter-character">inter-character</dfn>
    <dd>
     <p>The ruby text appears on the right of the base in horizontal text.
			This value forces the computed value of <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-writing-modes-4/#propdef-writing-mode" id="ref-for-propdef-writing-mode">writing-mode</a> of the <i>ruby annotation container</i> to be <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-writing-modes-4/#valdef-writing-mode-vertical-rl" id="ref-for-valdef-writing-mode-vertical-rl">vertical-rl</a>. </p>
     <p>This value is provided for the special case of traditional Chinese
			as used especially in Taiwan:
			ruby (made of <a href="#g-bopomofo">bopomofo</a> glyphs) in that context
			appears vertically along the right side of the base glyph,
			even when the layout of the base characters is horizontal: </p>
     <div class="figure">
      <p><img alt="Example of Taiwanese-style ruby" src="images/bopomofo.gif"> </p>
      <p class="caption">“Bopomofo” ruby in traditional Chinese
					(ruby text shown in blue for clarity) in horizontal layout </p>
     </div>
   </dl>
   <p>If multiple <i>ruby annotation containers</i> have the same <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position④">ruby-position</a>,
	they stack along the block axis,
	with lower levels of annotation closer to the base text. </p>
   <h3 class="heading settled" data-level="4.2" id="collapsed-ruby"><span class="secno">4.2. </span><span class="content"> Sharing Annotation Space: the <a class="property" data-link-type="propdesc" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge③">ruby-merge</a> property</span><a class="self-link" href="#collapsed-ruby"></a></h3>
   <table class="def propdef" data-link-for-hint="ruby-merge">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-ruby-merge">ruby-merge</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">separate <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑥">|</a> collapse <span id="ref-for-comb-one⑦">|</span> auto 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>separate 
     <tr>
      <th>Applies to:
      <td>ruby annotation containers 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>yes 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>n/a 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>specified keyword 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>by computed value type 
   </table>
   <p> This property controls how ruby annotation boxes should be rendered
		when there are more than one in a ruby container box:
		whether each pair should be kept separate,
		the annotations should be <dfn data-dfn-type="dfn" data-lt="collapsed annotation" data-noexport id="collapsed-annotation">collapsed<a class="self-link" href="#collapsed-annotation"></a></dfn> and rendered as a group,
		or the separation should be determined based on the space available. </p>
   <p>Possible values:</p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-merge" data-dfn-type="value" data-export id="valdef-ruby-merge-separate">separate</dfn> 
    <dd>
     <p> Each ruby annotation box is rendered in the same column(s) as its corresponding base box(es).
				This style is called “mono ruby” in <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>. </p>
     <div class="example" id="example-c95bac75">
      <a class="self-link" href="#example-c95bac75"></a> 
      <p>For example, the following two markups render the same: </p>
<pre>&lt;ruby>無&lt;rt>む&lt;/ruby>&lt;ruby>常&lt;rt>じょう&lt;/ruby></pre>
      <p>and: </p>
<pre>&lt;ruby style="ruby-merge:separate">&lt;rb>無&lt;rb>常&lt;rt>む&lt;rt>じょう&lt;/ruby></pre>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-merge" data-dfn-type="value" data-export id="valdef-ruby-merge-collapse">collapse</dfn> 
    <dd>
     <p> All <i>ruby annotation boxes</i> within the same <i>ruby segment</i> on the same line are concatenated,
				and laid out as if their contents belonged to a single <i>ruby annotation box</i> spanning all their associated <i>ruby base boxes</i>.
				This style renders similar to “group ruby” in <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>,
				except that <i>ruby annotations</i> are kept together with their respective <i>ruby bases</i> when breaking lines. </p>
     <div class="example" id="example-75d0f4f7">
      <a class="self-link" href="#example-75d0f4f7"></a> 
      <p>The following two markups render the same both characters fit on one line: </p>
<pre>&lt;ruby>無常&lt;rt>むじょう&lt;/ruby></pre>
      <p>and: </p>
<pre>&lt;ruby style="ruby-merge:collapse">&lt;rb>無&lt;rb>常&lt;rt>む&lt;rt>じょう&lt;/ruby></pre>
      <p>However, the second one renders the same as <a class="css" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position⑤">ruby-position: separate</a> when the two bases are split across lines. </p>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-merge" data-dfn-type="value" data-export id="valdef-ruby-merge-auto">auto</dfn>
    <dd>
     <p> The user agent may use any algorithm to determine how each ruby annotation box
				is rendered to its corresponding base box,
				with the intention that if all annotations fit over their respective bases,
				the result is identical to “mono ruby”,
				but if some annotations are wider than their bases
				the space is shared in some way
				to avoid imposing space between bases. </p>
     <div class="example" id="example-85d8104f">
      <a class="self-link" href="#example-85d8104f"></a> 
      <p> One possible algorithm is described as “jukugo ruby” in <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>. </p>
      <p> Another, more simplified algorithm of “jukugo ruby” is
				to render as <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-separate" id="ref-for-valdef-ruby-merge-separate①">separate</a> if all ruby annotation boxes fit
				within the advances of their corresponding base boxes,
				and render as <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-collapse" id="ref-for-valdef-ruby-merge-collapse①">collapse</a> otherwise. </p>
     </div>
   </dl>
   <h3 class="heading settled" data-level="4.3" id="ruby-align-property"><span class="secno">4.3. </span><span class="content"><span id="rubyalign"></span> Ruby Text Distribution: the <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align①">ruby-align</a> property</span><a class="self-link" href="#ruby-align-property"></a></h3>
   <table class="def propdef" data-link-for-hint="ruby-align">
    <tbody>
     <tr>
      <th>Name:
      <td><dfn class="dfn-paneled css" data-dfn-type="property" data-export id="propdef-ruby-align">ruby-align</dfn>
     <tr class="value">
      <th><a href="https://drafts.csswg.org/css-values/#value-defs">Value:</a>
      <td class="prod">start <a data-link-type="grammar" href="https://drafts.csswg.org/css-values-4/#comb-one" id="ref-for-comb-one⑧">|</a> center <span id="ref-for-comb-one⑨">|</span> space-between <span id="ref-for-comb-one①⓪">|</span> space-around 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#initial-values">Initial:</a>
      <td>space-around 
     <tr>
      <th>Applies to:
      <td>ruby bases, ruby annotations, ruby base containers, ruby annotation containers 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#inherited-property">Inherited:</a>
      <td>yes 
     <tr>
      <th><a href="https://drafts.csswg.org/css-values/#percentages">Percentages:</a>
      <td>n/a 
     <tr>
      <th><a href="https://drafts.csswg.org/css-cascade/#computed">Computed value:</a>
      <td>specified keyword 
     <tr>
      <th>Canonical order:
      <td>per grammar 
     <tr>
      <th><a href="https://drafts.csswg.org/web-animations/#animation-type">Animation type:</a>
      <td>by computed value type 
   </table>
   <p>This property specifies how text is distributed within the various ruby boxes
	when their contents do not exactly fill their respective boxes.
	Note that space distributed by <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align②">ruby-align</a> is unrelated to, and independent of,
	any space distributed due to justification. </p>
   <p>Values have the following meanings: </p>
   <dl>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-align" data-dfn-type="value" data-export id="valdef-ruby-align-start">start</dfn>
    <dd>
     The ruby content is aligned with the start edge of its box. 
     <div class="figure">
      <p><img alt="Diagram of glyph layout in left aligned ruby when ruby text is shorter than base" height="91" src="images/ra-l.gif" width="145"><img alt="Diagram of glyph layout in left aligned ruby when ruby text is longer than base" height="91" src="images/ra-l-rb.gif" width="145"> </p>
      <p class="caption"><a class="css" data-link-type="maybe" href="#valdef-ruby-align-start" id="ref-for-valdef-ruby-align-start">start</a> ruby distribution </p>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-align" data-dfn-type="value" data-export id="valdef-ruby-align-center">center</dfn>
    <dd>
     The ruby content is centered within its box. 
     <div class="figure">
      <p><img alt="Diagram of glyph layout in center aligned ruby when ruby text is shorter than base" height="91" src="images/ra-c.gif" width="145"><img alt="Diagram of glyph layout in center aligned ruby when ruby text is longer than base" height="91" src="images/ra-c-rb.gif" width="145"> </p>
      <p class="caption"><a class="css" data-link-type="maybe" href="#valdef-ruby-align-center" id="ref-for-valdef-ruby-align-center">center</a> ruby distribution </p>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-align" data-dfn-type="value" data-export id="valdef-ruby-align-space-between">space-between</dfn>
    <dd>
     <p>The ruby content expands as defined for normal text justification
				(as defined by <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-3/#propdef-text-justify" id="ref-for-propdef-text-justify">text-justify</a>),
				except that if there are no <i>justification opportunities</i> the content is centered. </p>
     <div class="figure">
      <p><img alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is shorter than base" height="91" src="images/ra-dl.gif" width="145"><img alt="Diagram of glyph layout in distribute-letter aligned ruby when ruby text is longer than base" height="91" src="images/ra-dl-rb.gif" width="145"> </p>
      <p class="caption"><a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-between" id="ref-for-valdef-ruby-align-space-between">space-between</a> ruby distribution </p>
     </div>
    <dt><dfn class="dfn-paneled css" data-dfn-for="ruby-align" data-dfn-type="value" data-export id="valdef-ruby-align-space-around">space-around</dfn>
    <dd>
     <p>As for <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-between" id="ref-for-valdef-ruby-align-space-between①">space-between</a> except that there exists an extra <i>justification opportunities</i> whose space is distributed half before and half after the ruby content. </p>
     <div class="example" id="example-fac0e6d5">
      <a class="self-link" href="#example-fac0e6d5"></a> 
      <p>Since a typical implementation will by default define <i>justification opportunities</i> between every adjacent pair of CJK <i>characters</i> and not between adjacent pairs of Latin <i>characters</i>,
					this should result in the behavior recommended by <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>:
					for wide-cell ruby content to be distributed... </p>
      <div class="figure">
       <p><img alt="Diagram of glyph layout in auto aligned ruby when ruby text is shorter than base" height="91" src="images/ra-ds.gif" width="145"><img alt="Diagram of glyph layout in auto aligned ruby when ruby text is longer than base" height="91" src="images/ra-ds-rb.gif" width="145"> </p>
       <p class="caption">Wide-cell text in <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-around" id="ref-for-valdef-ruby-align-space-around">space-around</a> ruby distribution is spaced apart </p>
      </div>
      <p>... and narrow-cell glyph ruby to be centered. </p>
      <div class="figure">
       <p><img alt="Diagram of glyph layout in auto aligned ruby when halfwidth ruby text is shorter than base" height="91" src="images/ra-c-h.gif" width="145"><img alt="Diagram of character layout in auto aligned ruby when ruby text is longer than narrow-width base" height="91" src="images/ra-c-rb-h.gif" width="145"> </p>
       <p class="caption">Narrow-width ruby text in <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-around" id="ref-for-valdef-ruby-align-space-around①">space-around</a> ruby distribution is centered </p>
      </div>
     </div>
   </dl>
   <p class="issue" id="issue-c66abaa7"><a class="self-link" href="#issue-c66abaa7"></a>Add a paragraph explaining how to distribute space in situations with spanning annotations. </p>
   <h3 class="heading settled" data-level="4.4" id="ruby-text-decoration"><span class="secno">4.4. </span><span class="content"> Ruby Text Decoration</span><a class="self-link" href="#ruby-text-decoration"></a></h3>
   <p>Text decoration does not propagate from the base text to the annotations. </p>
   <p>When text decoration is specified on an ancestor of the ruby,
	it is drawn across the entire content area of the ruby base container,
	including any extra space added on either side of the ruby base contents to accommodate long annotations.
	When text decoration is specified on a ruby base itself,
	this extra space is not decorated,
	similar to how a box’s own padding is not decorated when text decoration is specified directly on that box. <a data-link-type="biblio" href="#biblio-css3-text-decor">[CSS3-TEXT-DECOR]</a> </p>
   <p>Text decoration may be specified directly on ruby base containers
	and ruby annotation containers:
	in such cases it is propagated to all of the container’s bases or annotations (respectively),
	and is also drawn between them for continuity. </p>
   <p>The positions of ruby annotations may be adjusted
	to avoid potential conflicts
	with overline and underline decorations applied to the base text.
	In the basic case of consistent font size and baseline alignment,
	an underline or overline is positioned
	between the base level and any annotations on that side. </p>
   <p class="issue" id="issue-c8497783"><a class="self-link" href="#issue-c8497783"></a>This section needs some clarification about
	drawing decorations between the content of adjacent bases/annotations.
	Depends on if those boxes are as wide as their column or not. </p>
   <h2 class="heading settled" data-level="5" id="edge-effects"><span class="secno">5. </span><span class="content"> Edge Effects</span><a class="self-link" href="#edge-effects"></a></h2>
   <h3 class="heading settled" data-level="5.1" id="ruby-overhang"><span class="secno">5.1. </span><span class="content"> Overhanging Ruby</span><a class="self-link" href="#ruby-overhang"></a></h3>
   <p> When <i>ruby annotation box</i> is longer than its corresponding <i>ruby base box</i>,
		the <i>ruby annotation box</i> may partially overhang adjacent boxes. </p>
   <p> This level of the specification does not define
		how much the overhang may be allowed, and under what conditions. </p>
   <p>If the ruby text is not allowed to overhang,
	then the ruby behaves like a traditional inline box,
	i.e. only its own contents are rendered within its boundaries
	and adjacent elements do not cross the box boundary: </p>
   <div class="figure">
    <p><img alt="Diagram showing the ruby boxes interacting with adjacent text" src="images/ro-n.gif"> </p>
    <p class="caption">Simple ruby whose text is not allowed to overhang adjacent text </p>
   </div>
   <p>However, if <i>ruby annotation</i> content is allowed to overhang adjacent elements
	and it happens to be wider than its base,
	then the adjacent content is partially rendered within the area of the <i>ruby container box</i>,
	while the <i>ruby annotation</i> may partially overlap the upper blank parts of the adjacent content: </p>
   <div class="figure">
    <p><img alt="Diagram showing the ruby boxes interacting with adjacent text" src="images/ro-a.gif"> </p>
    <p class="caption">Simple ruby whose text is allowed to overhang adjacent text </p>
   </div>
   <p>The <i>ruby annotations</i> related to a <i>ruby base</i> must never overhang another <i>ruby base</i>. </p>
   <p>The alignment of the contents of the base or the ruby text
	is not affected by overhanging behavior.
	The alignment is achieved the same way regardless of the overhang behavior setting
	and it is computed before the space available for overlap is determined.
	It is controlled by the <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align③">ruby-align</a> property. </p>
   <p class="issue" id="issue-adc9f0e4"><a class="self-link" href="#issue-adc9f0e4"></a> I suspect overhanging interacts with alignment in some cases;
		might need to look into this later. </p>
   <p>This entire logic applies the same way in vertical ideographic layout,
	only the dimension in which it works in such a layout is vertical,
	instead of horizontal. </p>
   <div class="example" id="example-bf180944">
    <a class="self-link" href="#example-bf180944"></a> 
    <p> The user agent may use <a data-link-type="biblio" href="#biblio-jis4051">[JIS4051]</a> recommendation of
		using one ruby text character length as the maximum overhang length.
		Detailed rules for how ruby text can overhang adjacent characters for Japanese are described by <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>. </p>
   </div>
   <h3 class="heading settled" data-level="5.2" id="line-edge"><span class="secno">5.2. </span><span class="content"> Line-edge Alignment</span><a class="self-link" href="#line-edge"></a></h3>
   <p> When a <i>ruby annotation box</i> that is longer than its <i>ruby base</i> is at the start or end edge of a line,
		the user agent <em>may</em> force the side of the <i>ruby annotation</i> that touches the edge of the line
		to align to the corresponding edge of the base.
		This type of alignment is described by <a data-link-type="biblio" href="#biblio-jlreq">[JLREQ]</a>. </p>
   <p> This level of the specification does not provide a mechanism to control this behavior. </p>
   <div class="figure">
    <p><img alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is shorter than base" src="images/ra-le-l.gif"> <img alt="Diagram of glyph layout in line-edge aligned ruby when ruby text is longer than base" src="images/ra-le-r.gif"> </p>
    <p class="caption">Line-edge alignment </p>
   </div>
   <h2 class="no-num heading settled" id="default-stylesheet"><span class="content"> Appendix A: Default Style Sheet</span><a class="self-link" href="#default-stylesheet"></a></h2>
   <p><em>This section is informative.</em> </p>
   <h3 class="no-num heading settled" id="default-ua-ruby"><span class="content"> <span class="secno">A.1</span> Supporting Ruby Layout</span><a class="self-link" href="#default-ua-ruby"></a></h3>
   <p>The following represents a default UA style sheet
	for rendering HTML and XHTML ruby markup as ruby layout: </p>
<pre>ruby { display: ruby; }
rp   { display: none; }
rbc  { display: ruby-base-container; }
rtc  { display: ruby-text-container; }
rb   { display: ruby-base; white-space: nowrap; }
rt   { display: ruby-text; }
ruby, rb, rt, rbc, rtc { unicode-bidi: isolate; }

rtc, rt {
  font-variant-east-asian: ruby;  /* See [[CSS3-FONTS]] */
  text-emphasis: none;            /* See [[CSS3-TEXT-DECOR]] */
  white-space: nowrap;
  line-height: 1; }
rtc:lang(zh), rt:lang(zh) {
  ruby-align: center; }

rtc, :not(rtc) > rt {
  font-size: 50%; }
rtc:lang(zh-TW), :not(rtc) > rt:lang(zh-TW) {
  font-size: 30%; }               /* bopomofo */
</pre>
   <p class="note" role="note">Authors should not use the above rules:
	a UA that supports ruby layout should provide these by default. </p>
   <h3 class="no-num heading settled" id="default-inline"><span class="content"> <span class="secno">A.2</span> Inlining Ruby Annotations</span><a class="self-link" href="#default-inline"></a></h3>
   <p>The following represents a sample style sheet
	for rendering HTML and XHTML ruby markup as inline annotations: </p>
<pre>ruby, rb, rt, rbc, rtc, rp {display: inline; white-space: inherit;
font: inherit; text-emphasis: inherit; }</pre>
   <h3 class="no-num heading settled" id="default-parens"><span class="content"> <span class="secno">A.3</span> Generating Parentheses</span><a class="self-link" href="#default-parens"></a></h3>
   <p>Unfortunately, because Selectors cannot match against text nodes,
	it’s not possible with CSS to express rules that will automatically and correctly
	add parentheses to unparenthesized ruby annotations in HTML.
	(This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
	However, these rules will handle cases where either <code>&lt;rb></code> or <code>&lt;rtc></code> is used rigorously. </p>
<pre>/* Parens around &lt;rtc> */
rtc::before { content: "("; }
rtc::after  { content: ")"; }

/* Parens before first &lt;rt> not inside &lt;rtc> */
rb  + rt::before,
rtc + rt::before { content: "("; }

/* Parens after &lt;rt> not inside &lt;rtc> */
rb ~ rt:last-child::after,
rt + rb::before  { content: ")"; }
rt + rtc::before { content: ")("; }</pre>
   <h2 class="heading settled" data-level="6" id="glossary"><span class="secno">6. </span><span class="content"> Glossary</span><a class="self-link" href="#glossary"></a></h2>
   <dl>
    <dt id="g-bopomofo" lang="zh"><a class="self-link" href="#g-bopomofo"></a>Bopomofo 
    <dd>
     37 characters and 4 tone markings used as phonetics in Chinese,
      especially standard Mandarin. 
     <p class="note" role="note"> Note that the user agent is responsible for ensuring the correct relative alignment and positioning of the glyphs,
          including bopomofo tone marks, when displaying text,
          whether it occurs in ruby annotations or as normal inline text.
          Bopomofo Tone marks are spacing characters that occur (in memory) at the end of the ruby text for each base character.
          They are usually displayed in a separate column to the right of or above the bopomofo characters,
          and the position of the tone mark depends on the number of characters in the syllable.
          One tone mark, however, is placed before the bopomofo, not over it. </p>
    <dt id="g-hanja" lang="ko"><a class="self-link" href="#g-hanja"></a>Hanja 
    <dd>Subset of the Korean writing system that utilizes ideographic
      characters borrowed or adapted from the Chinese writing system. Also see <a href="#g-kanji"><span lang="ja">Kanji</span></a>.
    <dt id="g-hiragana" lang="ja"><a class="self-link" href="#g-hiragana"></a>Hiragana 
    <dd>Japanese syllabic script, or character of that script. Rounded and
    cursive in appearance. Subset of the Japanese writing system, used together
    with kanji and katakana. In recent times, mostly used to write Japanese
    words when kanji are not available or appropriate, and word endings and
    particles. Also see <a href="#g-katakana"><span lang="ja">Katakana</span></a>.
    <dt id="g-ideogram"><a class="self-link" href="#g-ideogram"></a>Ideograph 
    <dd>A character that is used to represent an idea, word, or word component,
    in contrast to a character from an alphabetic or syllabic script. The most
    well-known ideographic script is used (with some variation) in East Asia
    (China, Japan, Korea,...).
    <dt id="g-kana" lang="ja"><a class="self-link" href="#g-kana"></a>Kana 
    <dd>Collective term for hiragana and katakana.
    <dt id="g-kanji"><a class="self-link" href="#g-kanji"></a>Kanji 
    <dd>Japanese term for ideographs; ideographs used in Japanese. Subset of the
    Japanese writing system, used together with hiragana and katakana. Also see <a href="#g-hanja"><span lang="ko">Hanja</span></a>.
    <dt id="g-katakana" lang="ja"><a class="self-link" href="#g-katakana"></a>Katakana 
    <dd>Japanese syllabic script, or character of that script. Angular in
    appearance. Subset of the Japanese writing system,  used together with
    kanji and hiragana. In recent times, mainly used to write foreign words. Also see <a href="#g-hiragana"><span lang="ja">Hiragana</span></a>.
   </dl>
   <h2 class="no-num heading settled" id="acknowledgments"><span class="content"> Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2>
   <p>This specification would not have been possible without the help from:</p>
   <p> David Baron,
	Robin Berjon,
	Stephen Deach,
	Martin Dürst,
	Hideki Hiura (<span lang="ja">樋浦 秀樹</span>),
	Masayasu Ishikawa (<span lang="ja">石川雅康</span>),
	Taichi Kawabata,
	Chris Pratley,
	Xidorn Quan,
	Takao Suzuki (<span lang="ja">鈴木 孝雄</span>),
	Frank Yung-Fong Tang,
	Chris Thrasher,
	Masafumi Yabe (<span lang="ja">家辺勝文</span>),
	Boris Zbarsky,
	Steve Zilles. </p>
   <p>Special thanks goes to the previous editors:
	Michel Suignard and Marcin Sawicki of Microsoft,
	and Richard Ishida of W3C. </p>
   <h2 class="no-num heading settled" id="changes"><span class="content"> Changes</span><a class="self-link" href="#changes"></a></h2>
   <p>This section documents the changes since previous publications.</p>
   <h3 class="heading settled" id="changes-20140805"><span class="content"> Changes since the 5 August 2014 WD</span><a class="self-link" href="#changes-20140805"></a></h3>
   <ul>
    <li>Harmonize ininification with the <a href="https://www.w3.org/TR/css-display-3/">CSS Display Module</a>. 
    <li>Allow UA to shift ruby/emphasis marks if they conflict with underlines/overlines. 
    <li>Disable autohiding when the computed value of <a class="property" data-link-type="propdesc" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge④">ruby-merge</a> is <a class="css" data-link-type="maybe" href="#valdef-ruby-merge-collapse" id="ref-for-valdef-ruby-merge-collapse②">collapse</a>. 
    <li>Tweak the <a href="#default-stylesheet">default style sheet</a>. 
    <li>Add section on <a href="#ruby-text-decoration">text decoration</a>. 
    <li>Defer the <span class="css">right</span> and <span class="css">left</span> values of <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position⑥">ruby-position</a> to the next level. 
    <li>Change ruby pairing rules to only operate on anonymous annotations (i.e. content directly contained by an <code><a data-link-type="element">rtc</a></code>). 
    <li>Apply <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position⑦">ruby-position</a> to <a class="css" data-link-type="maybe" href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line" id="ref-for-selectordef-first-line②">::first-line</a>.
		(<a href="https://github.com/w3c/csswg-drafts/issues/2998">Issue 2998</a>) 
   </ul>
   <h3 class="heading settled" id="changes-20130919"><span class="content"> Changes since the 19 September 2013 WD</span><a class="self-link" href="#changes-20130919"></a></h3>
   <ul>
    <li>Rewrite anonymous box generation rules and white space handling rules,
		defined specialized pairing of anonymous white space boxes. 
    <li>Take nested ruby handling out of pairing.
		(Will be handling it via sizing/layout.) 
    <li>Define bidi layout of ruby structures. 
   </ul>
   <h3 class="heading settled" id="changes-20110630"><span class="content"> Changes since the 30 June 2011 WD</span><a class="self-link" href="#changes-20110630"></a></h3>
   <dl>
    <dt>Remove <a class="property" data-link-type="propdesc">ruby-span</a> and mentions of <code>rbspan</code>. 
    <dd> Explicit spanning is not used in HTML ruby in favor of implicit
				 spanning. This can’t handle some pathological double-sided spanning
				 cases, but there seems to be no requirement for these at the moment. (For
				 implementations that support full complex XHTML Ruby, they can imply
				 spanning from the markup the same magic way that we handle cell spanning
				 from tables. It doesn’t seem necessary to include controls this in Level
				 1.) 
    <dt>Defer <a class="property" data-link-type="propdesc">ruby-overhang</a> and <code>ruby-align: line-end</code> to Level 2. 
    <dd> It’s somewhat complicated, advanced feature. Proposal is to make this
				 behavior UA-defined and provide some examples of acceptable options. 
    <dt>Close issue requesting <code>display: rp</code>: use <code>display: none</code>. 
    <dd> The Internationalization WG added an issue requesting a display value
				 for <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-rp-element" id="ref-for-the-rp-element">rp</a></code> elements. They’re supposed to be hidden when <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element" id="ref-for-the-ruby-element">ruby</a></code> is
				 displayed as ruby. But this is easily accomplished already with <code>display: none</code>. 
    <dt>Change <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position⑧">ruby-position</a> values to match <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position" id="ref-for-propdef-text-emphasis-position">text-emphasis-position</a>. 
    <dd> Other than <a class="css" data-link-type="maybe" href="#valdef-ruby-position-inter-character" id="ref-for-valdef-ruby-position-inter-character⑦">inter-character</a>, which we
				 need to keep, it makes more sense to align ruby positions with <a class="property" data-link-type="propdesc" href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position" id="ref-for-propdef-text-emphasis-position①">text-emphasis-position</a>, which can correctly
				 handle various combinations of horizontal/vertical preferences. 
    <dt>Remove unused values of <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align④">ruby-align</a>. 
    <dd> <span class="css">left</span>, <span class="css">right</span>, and <span class="css">end</span> are not needed. 
    <dt>Replace <span class="css">auto</span>, <span class="css">distribute-letter</span>, and <span class="css">distribute-space</span> from <a class="property" data-link-type="propdesc" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align⑤">ruby-align</a> with <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-between" id="ref-for-valdef-ruby-align-space-between②">space-between</a> and <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-around" id="ref-for-valdef-ruby-align-space-around②">space-around</a>. 
    <dd> The <span class="css">auto</span> value relied on inspecting
				 content to determine behavior; this can be avoided by just using <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-around" id="ref-for-valdef-ruby-align-space-around③">space-around</a> with standard justification rules (which allow spacing between CJK but not between Latin).
				 Replaced <span class="css">distribute-letter</span> and <span class="css">distribute-space</span> with <a class="css" data-link-type="maybe" href="#valdef-ruby-align-space-between" id="ref-for-valdef-ruby-align-space-between③">space-between</a> and <span class="css" id="ref-for-valdef-ruby-align-space-around④">space-around</span> for consistency with distribution keywords in <a data-link-type="biblio" href="#biblio-css-flexbox-1">[CSS-FLEXBOX-1]</a> and <a data-link-type="biblio" href="#biblio-css-align-3">[CSS-ALIGN-3]</a> and to avoid any links to the definition of <code>text-justify: distribute</code>. 
    <dt>Added <a class="property" data-link-type="propdesc" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge⑤">ruby-merge</a> property to control jukugo rendering. 
    <dd> This is a stylistic effect, not a structural one; the previous model
				 assumed that it was structural and suggested handling it by changing
				 markup. :( 
    <dt>Remove <span class="css">inline</span> from <a class="property" data-link-type="propdesc" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position⑨">ruby-position</a>. 
    <dd> This is do-able via <code>display: inline</code> on
				 all the ruby-related elements, see <a href="#default-inline">Appendix A</a>. 
    <dt>Added <a href="#default-stylesheet">Default Style</a> rules 
    <dd> As requested by Internationalization WG. 
    <dt>Wrote anonymous box generation rules 
    <dd> And defined pairing of bases and annotations. Should now handle all
				 the crazy proposed permutations of HTML ruby markup. 
    <dt>Defined layout of ruby 
    <dd> Defined in detail space distribution, white space handling, line
				 breaking, line stacking, etc. Open issue left for bidi. 
   </dl>
  </main>
  <h2 class="no-ref no-num heading settled" id="conformance"><span class="content"> Conformance</span><a class="self-link" href="#conformance"></a></h2>
  <h3 class="heading settled" id="document-conventions"><span class="content"> Document conventions</span><a class="self-link" href="#document-conventions"></a></h3>
  <p>Conformance requirements are expressed with a combination of
	descriptive assertions and RFC 2119 terminology. The key words “MUST”,
	“MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
	“RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this
	document are to be interpreted as described in RFC 2119.
	However, for readability, these words do not appear in all uppercase
	letters in this specification. </p>
  <p>All of the text of this specification is normative except sections
	explicitly marked as non-normative, examples, and notes. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
  <p>Examples in this specification are introduced with the words “for example”
	or are set apart from the normative text with <code>class="example"</code>,
	like this: </p>
  <div class="example" id="example-ae2b6bc0">
   <a class="self-link" href="#example-ae2b6bc0"></a> 
   <p>This is an example of an informative example. </p>
  </div>
  <p>Informative notes begin with the word “Note” and are set apart from the
	normative text with <code>class="note"</code>, like this: </p>
  <p class="note" role="note">Note, this is an informative note. </p>
  <p>Advisements are normative sections styled to evoke special attention and are
	set apart from other normative text with <code>&lt;strong class="advisement"></code>, like
	this: <strong class="advisement"> UAs MUST provide an accessible alternative. </strong> </p>
  <h3 class="heading settled" id="conform-classes"><span class="content"> Conformance classes</span><a class="self-link" href="#conform-classes"></a></h3>
  <p>Conformance to this specification
	is defined for three conformance classes: </p>
  <dl>
   <dt>style sheet 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#style-sheet">CSS
			style sheet</a>. 
   <dt>renderer 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that interprets the semantics of a style sheet and renders
			documents that use them. 
   <dt>authoring tool 
   <dd>A <a href="http://www.w3.org/TR/CSS2/conform.html#user-agent">UA</a> that writes a style sheet. 
  </dl>
  <p>A style sheet is conformant to this specification
	if all of its statements that use syntax defined in this module are valid
	according to the generic CSS grammar and the individual grammars of each
	feature defined in this module. </p>
  <p>A renderer is conformant to this specification
	if, in addition to interpreting the style sheet as defined by the
	appropriate specifications, it supports all the features defined
	by this specification by parsing them correctly
	and rendering the document accordingly. However, the inability of a
	UA to correctly render a document due to limitations of the device
	does not make the UA non-conformant. (For example, a UA is not
	required to render color on a monochrome monitor.) </p>
  <p>An authoring tool is conformant to this specification
	if it writes style sheets that are syntactically correct according to the
	generic CSS grammar and the individual grammars of each feature in
	this module, and meet all other conformance requirements of style sheets
	as described in this module. </p>
  <h3 class="heading settled" id="conform-responsible"><span class="content"> Requirements for Responsible Implementation of CSS</span><a class="self-link" href="#conform-responsible"></a></h3>
  <p>The following sections define several conformance requirements
		for implementing CSS responsibly,
		in a way that promotes interoperability in the present and future. </p>
  <h4 class="heading settled" id="conform-partial"><span class="content"> Partial Implementations</span><a class="self-link" href="#conform-partial"></a></h4>
  <p>So that authors can exploit the forward-compatible parsing rules to assign fallback values, <strong>CSS renderers <em>must</em> treat as invalid
		(and <a href="http://www.w3.org/TR/CSS2/conform.html#ignore">ignore as appropriate</a>)
		any at-rules, properties, property values, keywords, and other syntactic constructs
		for which they have no usable level of support</strong>.
		In particular, user agents <em>must not</em> selectively ignore
		unsupported property values and honor supported values in a single multi-value property declaration:
		if any value is considered invalid (as unsupported values must be),
		CSS requires that the entire declaration be ignored. </p>
  <h4 class="heading settled" id="conform-future-proofing"><span class="content"> Implementations of Unstable and Proprietary Features</span><a class="self-link" href="#conform-future-proofing"></a></h4>
  <p>To avoid clashes with future stable CSS features,
		the CSSWG recommends <a href="http://www.w3.org/TR/CSS/#future-proofing">following best practices</a> for the implementation of <a href="http://www.w3.org/TR/CSS/#unstable">unstable</a> features and <a href="http://www.w3.org/TR/CSS/#proprietary-extension">proprietary extensions</a> to CSS. </p>
  <h4 class="heading settled" id="conform-testing"><span class="content"> Implementations of CR-level Features</span><a class="self-link" href="#conform-testing"></a></h4>
  <p>Once a specification reaches the Candidate Recommendation stage,
		implementers should release an <a data-link-type="dfn" href="http://www.w3.org/TR/CSS/#vendor-prefix">unprefixed</a> implementation
		of any CR-level feature they can demonstrate
		to be correctly implemented according to spec,
		and should avoid exposing a prefixed variant of that feature. </p>
  <p>To establish and maintain the interoperability of CSS across
		implementations, the CSS Working Group requests that non-experimental
		CSS renderers submit an implementation report (and, if necessary, the
		testcases used for that implementation report) to the W3C before
		releasing an unprefixed implementation of any CSS features. Testcases
		submitted to W3C are subject to review and correction by the CSS
		Working Group. </p>
  <p>
   Further information on submitting testcases and implementation reports
		can be found from on the CSS Working Group’s website at <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>.
		Questions should be directed to the <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> mailing list. 
<script src="https://www.w3.org/scripts/TR/2016/fixup.js"></script>
  </p>
  <h2 class="no-num no-ref heading settled" id="index"><span class="content">Index</span><a class="self-link" href="#index"></a></h2>
  <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="content">Terms defined by this specification</span><a class="self-link" href="#index-defined-here"></a></h3>
  <ul class="index">
   <li><a href="#ruby-annotation-box">annotation</a><span>, in §2.1</span>
   <li><a href="#annotation-level">annotation level</a><span>, in §2.3.1</span>
   <li><a href="#valdef-ruby-merge-auto">auto</a><span>, in §4.2</span>
   <li><a href="#base-level">base level</a><span>, in §2.3.1</span>
   <li><a href="#valdef-ruby-align-center">center</a><span>, in §4.3</span>
   <li><a href="#valdef-ruby-merge-collapse">collapse</a><span>, in §4.2</span>
   <li><a href="#collapsed-annotation">collapsed annotation</a><span>, in §4.2</span>
   <li><a href="#hidden-ruby-annotation">hidden annotation</a><span>, in §2.4</span>
   <li><a href="#hidden-ruby-annotation">hidden ruby annotation</a><span>, in §2.4</span>
   <li><a href="#inter-annotation-white-space">inter-annotation white space</a><span>, in §2.2</span>
   <li><a href="#inter-base-white-space">inter-base white space</a><span>, in §2.2</span>
   <li><a href="#valdef-ruby-position-inter-character">inter-character</a><span>, in §4.1</span>
   <li><a href="#inter-level-white-space">inter-level white space</a><span>, in §2.2</span>
   <li><a href="#internal-ruby-boxes">internal ruby boxes</a><span>, in §2.1.1</span>
   <li><a href="#internal-ruby-boxes">internal ruby display types</a><span>, in §2.1.1</span>
   <li><a href="#inter-segment-white-space">inter-segment white space</a><span>, in §2.2</span>
   <li><a href="#intra-level-white-space">intra-level white space</a><span>, in §2.2</span>
   <li><a href="#intra-ruby-white-space">intra-ruby white space</a><span>, in §2.2</span>
   <li><a href="#annotation-level">level</a><span>, in §2.3.1</span>
   <li><a href="#nested-ruby">nested ruby</a><span>, in §2.3.3</span>
   <li><a href="#valdef-ruby-position-over">over</a><span>, in §4.1</span>
   <li><a href="#pairing">pairing</a><span>, in §2.3</span>
   <li><a href="#valdef-display-ruby">ruby</a><span>, in §2.1</span>
   <li><a href="#ruby">Ruby</a><span>, in §1.4</span>
   <li><a href="#propdef-ruby-align">ruby-align</a><span>, in §4.3</span>
   <li><a href="#ruby-annotation-box">ruby annotation</a><span>, in §2.1</span>
   <li><a href="#ruby-annotation-box">ruby annotation box</a><span>, in §2.1</span>
   <li><a href="#ruby-annotation-container-box">ruby annotation container</a><span>, in §2.1</span>
   <li><a href="#ruby-annotation-container-box">ruby annotation container box</a><span>, in §2.1</span>
   <li><a href="#ruby-base-box">ruby base</a><span>, in §2.1</span>
   <li><a href="#valdef-display-ruby-base">ruby-base</a><span>, in §2.1</span>
   <li><a href="#ruby-base-box">ruby base box</a><span>, in §2.1</span>
   <li><a href="#ruby-base-container-box">ruby base container</a><span>, in §2.1</span>
   <li><a href="#valdef-display-ruby-base-container">ruby-base-container</a><span>, in §2.1</span>
   <li><a href="#ruby-base-container-box">ruby base container box</a><span>, in §2.1</span>
   <li><a href="#ruby-container">ruby container</a><span>, in §2.1</span>
   <li><a href="#ruby-container">ruby container box</a><span>, in §2.1</span>
   <li><a href="#ruby-formatting-context">ruby formatting context</a><span>, in §2.1.1</span>
   <li><a href="#propdef-ruby-merge">ruby-merge</a><span>, in §4.2</span>
   <li><a href="#propdef-ruby-position">ruby-position</a><span>, in §4.1</span>
   <li><a href="#ruby-segments">ruby segments</a><span>, in §2.3.1</span>
   <li><a href="#valdef-display-ruby-text">ruby-text</a><span>, in §2.1</span>
   <li><a href="#valdef-display-ruby-text-container">ruby-text-container</a><span>, in §2.1</span>
   <li><a href="#valdef-ruby-merge-separate">separate</a><span>, in §4.2</span>
   <li><a href="#valdef-ruby-align-space-around">space-around</a><span>, in §4.3</span>
   <li><a href="#valdef-ruby-align-space-between">space-between</a><span>, in §4.3</span>
   <li><a href="#span">span</a><span>, in §2.3</span>
   <li><a href="#spanning-annotation">spanning annotation</a><span>, in §2.3</span>
   <li><a href="#valdef-ruby-align-start">start</a><span>, in §4.3</span>
   <li><a href="#valdef-ruby-position-under">under</a><span>, in §4.1</span>
  </ul>
  <aside class="dfn-panel" data-for="term-for-propdef-padding">
   <a href="https://drafts.csswg.org/css-box-3/#propdef-padding">https://drafts.csswg.org/css-box-3/#propdef-padding</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-padding">3.5. 
Line Spacing</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-display-block">
   <a href="https://drafts.csswg.org/css-display-3/#valdef-display-block">https://drafts.csswg.org/css-display-3/#valdef-display-block</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-display-block">2.1.2. 
Non-Inline Ruby</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-display">
   <a href="https://drafts.csswg.org/css-display-3/#propdef-display">https://drafts.csswg.org/css-display-3/#propdef-display</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-display">2.1. 
Ruby-specific display Values</a> <a href="#ref-for-propdef-display①">(2)</a> <a href="#ref-for-propdef-display②">(3)</a> <a href="#ref-for-propdef-display③">(4)</a> <a href="#ref-for-propdef-display④">(5)</a>
    <li><a href="#ref-for-propdef-display⑤">2.1.2. 
Non-Inline Ruby</a> <a href="#ref-for-propdef-display⑥">(2)</a>
    <li><a href="#ref-for-propdef-display⑦">2.2. 
Anonymous Ruby Box Generation</a> <a href="#ref-for-propdef-display⑧">(2)</a> <a href="#ref-for-propdef-display⑨">(3)</a> <a href="#ref-for-propdef-display①⓪">(4)</a> <a href="#ref-for-propdef-display①①">(5)</a> <a href="#ref-for-propdef-display①②">(6)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-display-inline">
   <a href="https://drafts.csswg.org/css-display-3/#valdef-display-inline">https://drafts.csswg.org/css-display-3/#valdef-display-inline</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-display-inline">2.1.2. 
Non-Inline Ruby</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-display-inline-block">
   <a href="https://drafts.csswg.org/css-display-3/#valdef-display-inline-block">https://drafts.csswg.org/css-display-3/#valdef-display-inline-block</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-display-inline-block">2.2. 
Anonymous Ruby Box Generation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-inline-level">
   <a href="https://drafts.csswg.org/css-display-3/#inline-level">https://drafts.csswg.org/css-display-3/#inline-level</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-inline-level">2.2. 
Anonymous Ruby Box Generation</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-inlinify">
   <a href="https://drafts.csswg.org/css-display-3/#inlinify">https://drafts.csswg.org/css-display-3/#inlinify</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-inlinify">2.2. 
Anonymous Ruby Box Generation</a> <a href="#ref-for-inlinify①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-vertical-align">
   <a href="https://drafts.csswg.org/css-inline-3/#propdef-vertical-align">https://drafts.csswg.org/css-inline-3/#propdef-vertical-align</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-vertical-align">3. 
Ruby Layout</a>
    <li><a href="#ref-for-propdef-vertical-align①">3.5. 
Line Spacing</a> <a href="#ref-for-propdef-vertical-align②">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-selectordef-first-letter">
   <a href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter">https://drafts.csswg.org/css-pseudo-4/#selectordef-first-letter</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-first-letter">1.1. 
Module interactions</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-selectordef-first-line">
   <a href="https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line">https://drafts.csswg.org/css-pseudo-4/#selectordef-first-line</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-selectordef-first-line">1.1. 
Module interactions</a> <a href="#ref-for-selectordef-first-line①">(2)</a>
    <li><a href="#ref-for-selectordef-first-line②"> Changes since the 5 August 2014 WD</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-white-space">
   <a href="https://drafts.csswg.org/css-text-4/#propdef-white-space">https://drafts.csswg.org/css-text-4/#propdef-white-space</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-white-space">2.2. 
Anonymous Ruby Box Generation</a>
    <li><a href="#ref-for-propdef-white-space①">2.4. 
Autohiding Base-identical Annotations</a>
    <li><a href="#ref-for-propdef-white-space②">3.3.2. 
Breaking Within Bases</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-css-wide-keywords">
   <a href="https://drafts.csswg.org/css-values-4/#css-wide-keywords">https://drafts.csswg.org/css-values-4/#css-wide-keywords</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-css-wide-keywords">1.2. 
Values</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-comb-one">
   <a href="https://drafts.csswg.org/css-values-4/#comb-one">https://drafts.csswg.org/css-values-4/#comb-one</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-comb-one">2.1. 
Ruby-specific display Values</a> <a href="#ref-for-comb-one①">(2)</a> <a href="#ref-for-comb-one②">(3)</a> <a href="#ref-for-comb-one③">(4)</a>
    <li><a href="#ref-for-comb-one④">4.1. 
Ruby Positioning: the ruby-position property</a> <a href="#ref-for-comb-one⑤">(2)</a>
    <li><a href="#ref-for-comb-one⑥">4.2. 
Sharing Annotation Space: the ruby-merge property</a> <a href="#ref-for-comb-one⑦">(2)</a>
    <li><a href="#ref-for-comb-one⑧">4.3. 
Ruby Text Distribution: the ruby-align property</a> <a href="#ref-for-comb-one⑨">(2)</a> <a href="#ref-for-comb-one①⓪">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-unicode-bidi-bidi-override">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-bidi-override">https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-bidi-override</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-unicode-bidi-bidi-override">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-unicode-bidi-embed">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-embed">https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-embed</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-unicode-bidi-embed">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-unicode-bidi-isolate">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate">https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-unicode-bidi-isolate">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-unicode-bidi-isolate-override">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate-override">https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-isolate-override</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-unicode-bidi-isolate-override">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-line-over">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#line-over">https://drafts.csswg.org/css-writing-modes-4/#line-over</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-line-over">4.1. 
Ruby Positioning: the ruby-position property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-line-under">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#line-under">https://drafts.csswg.org/css-writing-modes-4/#line-under</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-line-under">4.1. 
Ruby Positioning: the ruby-position property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-unicode-bidi-normal">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-normal">https://drafts.csswg.org/css-writing-modes-4/#valdef-unicode-bidi-normal</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-unicode-bidi-normal">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-writing-mode-vertical-rl">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#valdef-writing-mode-vertical-rl">https://drafts.csswg.org/css-writing-modes-4/#valdef-writing-mode-vertical-rl</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-writing-mode-vertical-rl">4.1. 
Ruby Positioning: the ruby-position property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-writing-mode">
   <a href="https://drafts.csswg.org/css-writing-modes-4/#propdef-writing-mode">https://drafts.csswg.org/css-writing-modes-4/#propdef-writing-mode</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-writing-mode">4.1. 
Ruby Positioning: the ruby-position property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-line-height">
   <a href="https://drafts.csswg.org/css2/visudet.html#propdef-line-height">https://drafts.csswg.org/css2/visudet.html#propdef-line-height</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-line-height">3.5. 
Line Spacing</a> <a href="#ref-for-propdef-line-height①">(2)</a> <a href="#ref-for-propdef-line-height②">(3)</a> <a href="#ref-for-propdef-line-height③">(4)</a> <a href="#ref-for-propdef-line-height④">(5)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-emphasis-position">
   <a href="https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position">https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-position</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-emphasis-position"> Changes since the 30 June 2011 WD</a> <a href="#ref-for-propdef-text-emphasis-position①">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-direction">
   <a href="https://drafts.csswg.org/css-writing-modes-3/#propdef-direction">https://drafts.csswg.org/css-writing-modes-3/#propdef-direction</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-direction">3.4. 
Bidi Reordering</a> <a href="#ref-for-propdef-direction①">(2)</a> <a href="#ref-for-propdef-direction②">(3)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-unicode-bidi">
   <a href="https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi">https://drafts.csswg.org/css-writing-modes-3/#propdef-unicode-bidi</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-unicode-bidi">3.4. 
Bidi Reordering</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-valdef-word-break-keep-all">
   <a href="https://drafts.csswg.org/css-text-3/#valdef-word-break-keep-all">https://drafts.csswg.org/css-text-3/#valdef-word-break-keep-all</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-word-break-keep-all">3.3.1. 
Breaking Between Bases</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-justify">
   <a href="https://drafts.csswg.org/css-text-3/#propdef-text-justify">https://drafts.csswg.org/css-text-3/#propdef-text-justify</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-justify">4.3. 
Ruby Text Distribution: the ruby-align property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-text-transform">
   <a href="https://drafts.csswg.org/css-text-3/#propdef-text-transform">https://drafts.csswg.org/css-text-3/#propdef-text-transform</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-text-transform">2.4. 
Autohiding Base-identical Annotations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-propdef-word-break">
   <a href="https://drafts.csswg.org/css-text-3/#propdef-word-break">https://drafts.csswg.org/css-text-3/#propdef-word-break</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-word-break">3.3.1. 
Breaking Between Bases</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-rp-element">
   <a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-rp-element">https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-rp-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-rp-element"> Changes since the 30 June 2011 WD</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="term-for-the-ruby-element">
   <a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element">https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-ruby-element</a><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-the-ruby-element"> Changes since the 30 June 2011 WD</a>
   </ul>
  </aside>
  <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span class="content">Terms defined by reference</span><a class="self-link" href="#index-defined-elsewhere"></a></h3>
  <ul class="index">
   <li>
    <a data-link-type="biblio">[css-box-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-padding" style="color:initial">padding</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS-DISPLAY-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-valdef-display-block" style="color:initial">block</span>
     <li><span class="dfn-paneled" id="term-for-propdef-display" style="color:initial">display</span>
     <li><span class="dfn-paneled" id="term-for-valdef-display-inline" style="color:initial">inline</span>
     <li><span class="dfn-paneled" id="term-for-valdef-display-inline-block" style="color:initial">inline-block</span>
     <li><span class="dfn-paneled" id="term-for-inline-level" style="color:initial">inline-level content</span>
     <li><span class="dfn-paneled" id="term-for-inlinify" style="color:initial">inlinify</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-inline-3]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-vertical-align" style="color:initial">vertical-align</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-pseudo-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-selectordef-first-letter" style="color:initial">::first-letter</span>
     <li><span class="dfn-paneled" id="term-for-selectordef-first-line" style="color:initial">::first-line</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-text-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-white-space" style="color:initial">white-space</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-values-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-css-wide-keywords" style="color:initial">css-wide keywords</span>
     <li><span class="dfn-paneled" id="term-for-comb-one" style="color:initial">|</span>
    </ul>
   <li>
    <a data-link-type="biblio">[css-writing-modes-4]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-valdef-unicode-bidi-bidi-override" style="color:initial">bidi-override</span>
     <li><span class="dfn-paneled" id="term-for-valdef-unicode-bidi-embed" style="color:initial">embed</span>
     <li><span class="dfn-paneled" id="term-for-valdef-unicode-bidi-isolate" style="color:initial">isolate</span>
     <li><span class="dfn-paneled" id="term-for-valdef-unicode-bidi-isolate-override" style="color:initial">isolate-override</span>
     <li><span class="dfn-paneled" id="term-for-line-over" style="color:initial">line-over</span>
     <li><span class="dfn-paneled" id="term-for-line-under" style="color:initial">line-under</span>
     <li><span class="dfn-paneled" id="term-for-valdef-unicode-bidi-normal" style="color:initial">normal</span>
     <li><span class="dfn-paneled" id="term-for-valdef-writing-mode-vertical-rl" style="color:initial">vertical-rl</span>
     <li><span class="dfn-paneled" id="term-for-propdef-writing-mode" style="color:initial">writing-mode</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS2]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-line-height" style="color:initial">line-height</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS3-TEXT-DECOR]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-text-emphasis-position" style="color:initial">text-emphasis-position</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS3-WRITING-MODES]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-propdef-direction" style="color:initial">direction</span>
     <li><span class="dfn-paneled" id="term-for-propdef-unicode-bidi" style="color:initial">unicode-bidi</span>
    </ul>
   <li>
    <a data-link-type="biblio">[CSS3TEXT]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-valdef-word-break-keep-all" style="color:initial">keep-all</span>
     <li><span class="dfn-paneled" id="term-for-propdef-text-justify" style="color:initial">text-justify</span>
     <li><span class="dfn-paneled" id="term-for-propdef-text-transform" style="color:initial">text-transform</span>
     <li><span class="dfn-paneled" id="term-for-propdef-word-break" style="color:initial">word-break</span>
    </ul>
   <li>
    <a data-link-type="biblio">[HTML]</a> defines the following terms:
    <ul>
     <li><span class="dfn-paneled" id="term-for-the-rp-element" style="color:initial">rp</span>
     <li><span class="dfn-paneled" id="term-for-the-ruby-element" style="color:initial">ruby</span>
    </ul>
  </ul>
  <h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
  <h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
  <dl>
   <dt id="biblio-css-box-3">[CSS-BOX-3]
   <dd>Elika Etemad. <a href="https://www.w3.org/TR/css-box-3/">CSS Box Model Module Level 3</a>. 18 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-box-3/">https://www.w3.org/TR/css-box-3/</a>
   <dt id="biblio-css-display-3">[CSS-DISPLAY-3]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-display-3/">CSS Display Module Level 3</a>. 28 August 2018. CR. URL: <a href="https://www.w3.org/TR/css-display-3/">https://www.w3.org/TR/css-display-3/</a>
   <dt id="biblio-css-inline-3">[CSS-INLINE-3]
   <dd>Dave Cramer; Elika Etemad; Steve Zilles. <a href="https://www.w3.org/TR/css-inline-3/">CSS Inline Layout Module Level 3</a>. 8 August 2018. WD. URL: <a href="https://www.w3.org/TR/css-inline-3/">https://www.w3.org/TR/css-inline-3/</a>
   <dt id="biblio-css-pseudo-4">[CSS-PSEUDO-4]
   <dd>Daniel Glazman; Elika Etemad; Alan Stearns. <a href="https://www.w3.org/TR/css-pseudo-4/">CSS Pseudo-Elements Module Level 4</a>. 25 February 2019. WD. URL: <a href="https://www.w3.org/TR/css-pseudo-4/">https://www.w3.org/TR/css-pseudo-4/</a>
   <dt id="biblio-css-text-4">[CSS-TEXT-4]
   <dd>Elika Etemad; Koji Ishii; Alan Stearns. <a href="https://www.w3.org/TR/css-text-4/">CSS Text Module Level 4</a>. 20 September 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-4/">https://www.w3.org/TR/css-text-4/</a>
   <dt id="biblio-css-values-3">[CSS-VALUES-3]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-3/">CSS Values and Units Module Level 3</a>. 31 January 2019. CR. URL: <a href="https://www.w3.org/TR/css-values-3/">https://www.w3.org/TR/css-values-3/</a>
   <dt id="biblio-css-values-4">[CSS-VALUES-4]
   <dd>Tab Atkins Jr.; Elika Etemad. <a href="https://www.w3.org/TR/css-values-4/">CSS Values and Units Module Level 4</a>. 31 January 2019. WD. URL: <a href="https://www.w3.org/TR/css-values-4/">https://www.w3.org/TR/css-values-4/</a>
   <dt id="biblio-css-writing-modes-4">[CSS-WRITING-MODES-4]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-4/">CSS Writing Modes Level 4</a>. 24 May 2018. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-4/">https://www.w3.org/TR/css-writing-modes-4/</a>
   <dt id="biblio-css2">[CSS2]
   <dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS2/">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS2/">https://www.w3.org/TR/CSS2/</a>
   <dt id="biblio-css3-text-decor">[CSS3-TEXT-DECOR]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-text-decor-3/">CSS Text Decoration Module Level 3</a>. 3 July 2018. CR. URL: <a href="https://www.w3.org/TR/css-text-decor-3/">https://www.w3.org/TR/css-text-decor-3/</a>
   <dt id="biblio-css3-writing-modes">[CSS3-WRITING-MODES]
   <dd>Elika Etemad; Koji Ishii. <a href="https://www.w3.org/TR/css-writing-modes-3/">CSS Writing Modes Level 3</a>. 24 May 2018. CR. URL: <a href="https://www.w3.org/TR/css-writing-modes-3/">https://www.w3.org/TR/css-writing-modes-3/</a>
   <dt id="biblio-css3text">[CSS3TEXT]
   <dd>Elika Etemad; Koji Ishii; Florian Rivoal. <a href="https://www.w3.org/TR/css-text-3/">CSS Text Module Level 3</a>. 12 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-text-3/">https://www.w3.org/TR/css-text-3/</a>
   <dt id="biblio-html">[HTML]
   <dd>Anne van Kesteren; et al. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
   <dt id="biblio-rfc2119">[RFC2119]
   <dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
  </dl>
  <h3 class="no-num no-ref heading settled" id="informative"><span class="content">Informative References</span><a class="self-link" href="#informative"></a></h3>
  <dl>
   <dt id="biblio-css-align-3">[CSS-ALIGN-3]
   <dd>Elika Etemad; Tab Atkins Jr.. <a href="https://www.w3.org/TR/css-align-3/">CSS Box Alignment Module Level 3</a>. 6 December 2018. WD. URL: <a href="https://www.w3.org/TR/css-align-3/">https://www.w3.org/TR/css-align-3/</a>
   <dt id="biblio-css-flexbox-1">[CSS-FLEXBOX-1]
   <dd>Tab Atkins Jr.; et al. <a href="https://www.w3.org/TR/css-flexbox-1/">CSS Flexible Box Layout Module Level 1</a>. 19 November 2018. CR. URL: <a href="https://www.w3.org/TR/css-flexbox-1/">https://www.w3.org/TR/css-flexbox-1/</a>
   <dt id="biblio-jis4051">[JIS4051]
   <dd><cite>Formatting rules for Japanese documents (『日本語文書の組版方法』).</cite> Japanese Standards Association. 2004. JIS X 4051:2004. In Japanese
   <dt id="biblio-jlreq">[JLREQ]
   <dd>Yasuhiro Anan; et al. <a href="https://www.w3.org/TR/jlreq/">Requirements for Japanese Text Layout</a>. 3 April 2012. NOTE. URL: <a href="https://www.w3.org/TR/jlreq/">https://www.w3.org/TR/jlreq/</a>
   <dt id="biblio-ruby">[RUBY]
   <dd>Marcin Sawicki; et al. <a href="https://www.w3.org/TR/ruby/">Ruby Annotation</a>. 31 May 2001. REC. URL: <a href="https://www.w3.org/TR/ruby/">https://www.w3.org/TR/ruby/</a>
  </dl>
  <h2 class="no-num no-ref heading settled" id="property-index"><span class="content">Property Index</span><a class="self-link" href="#property-index"></a></h2>
  <div class="big-element-wrapper">
   <table class="index">
    <thead>
     <tr>
      <th scope="col">Name
      <th scope="col">Value
      <th scope="col">Initial
      <th scope="col">Applies to
      <th scope="col">Inh.
      <th scope="col">%ages
      <th scope="col">Anim­ation type
      <th scope="col">Canonical order
      <th scope="col">Com­puted value
    <tbody>
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-ruby-align" id="ref-for-propdef-ruby-align⑥">ruby-align</a>
      <td>start | center | space-between | space-around
      <td>space-around
      <td>ruby bases, ruby annotations, ruby base containers, ruby annotation containers
      <td>yes
      <td>n/a
      <td>by computed value type
      <td>per grammar
      <td>specified keyword
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-ruby-merge" id="ref-for-propdef-ruby-merge⑥">ruby-merge</a>
      <td>separate | collapse | auto
      <td>separate
      <td>ruby annotation containers
      <td>yes
      <td>n/a
      <td>by computed value type
      <td>per grammar
      <td>specified keyword
     <tr>
      <th scope="row"><a class="css" data-link-type="property" href="#propdef-ruby-position" id="ref-for-propdef-ruby-position①⓪">ruby-position</a>
      <td>over | under | inter-character
      <td>over
      <td>ruby annotation containers
      <td>yes
      <td>n/a
      <td>discrete
      <td>per grammar
      <td>specified keyword
   </table>
  </div>
  <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
  <div style="counter-reset:issue">
   <div class="issue">Are internal ruby boxes inline-level? <a href="#issue-ca88244c"> ↵ </a></div>
   <div class="issue">The goal of this is to simplify the layout model by suppressing any line breaks within ruby annotations.
			Alternatively we could try to define some kind of acceptable behavior for them. <a href="#issue-f0987196"> ↵ </a></div>
   <div class="issue">Make <a href="http://lists.w3.org/Archives/Public/www-archive/2014Jun/att-0027/PastedGraphic-1.png">this diagram</a> into an example. <a href="#issue-dfd9c615"> ↵ </a></div>
   <div class="issue">Insert diagram<a href="#issue-0230a91a"> ↵ </a></div>
   <div class="issue">It’s not clear whether this falls out of layout handling of ruby containers inside ruby bases
	or needs to be handled specially.
	Waiting until layout is better-defined to find out... <a href="#issue-ec2866e8"> ↵ </a></div>
   <div class="issue">Should block-axis margins collapse?
	This makes layout more robust,
	but is inconsistent with how inlines behave along the inline-axis. <a href="#issue-ea5c17b0"> ↵ </a></div>
   <div class="issue">Should the ruby bases and annotations size to the column,
	or size to the content? <a href="#issue-cc873b76"> ↵ </a></div>
   <div class="issue">Or should it become a quasi-base between two bases?<a href="#issue-029133da"> ↵ </a></div>
   <div class="issue"> Insert scanned example so people don’t think this is just the ramblings of an insane spec-writer. <a href="#issue-14d7c6b1"> ↵ </a></div>
   <div class="issue"><span class="issuehead">Issue-107: </span> Roland Steiner has requested the addition of an auto value as default. See <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&amp;hdr-1-name=subject&amp;hdr-1-query=ruby-position%3A+undesirable+default+value+%27before%27+for+complex+ruby&amp;hdr-2-name=from&amp;hdr-2-query=&amp;hdr-3-name=message-id&amp;hdr-3-query=&amp;period_month=&amp;period_year=&amp;index-grp=Public__FULL&amp;index-type=t&amp;type-index=www-style&amp;resultsperpage=20&amp;sortby=date">this thread</a> and <a href="http://www.w3.org/Search/Mail/Public/advanced_search?keywords=&amp;hdr-1-name=subject&amp;hdr-1-query=Styling+of+complex+Ruby&amp;hdr-2-name=from&amp;hdr-2-query=&amp;hdr-3-name=message-id&amp;hdr-3-query=&amp;period_month=&amp;period_year=&amp;index-grp=Public__FULL&amp;index-type=t&amp;type-index=public-i18n-core&amp;resultsperpage=20&amp;sortby=date">this one</a>. Current proposal is to add an optional <span class="css">alternate?</span> keyword.<a href="#issue-99cf2a0d"> ↵ </a></div>
   <div class="issue">Add a paragraph explaining how to distribute space in situations with spanning annotations. <a href="#issue-c66abaa7"> ↵ </a></div>
   <div class="issue">This section needs some clarification about
	drawing decorations between the content of adjacent bases/annotations.
	Depends on if those boxes are as wide as their column or not. <a href="#issue-c8497783"> ↵ </a></div>
   <div class="issue"> I suspect overhanging interacts with alignment in some cases;
		might need to look into this later. <a href="#issue-adc9f0e4"> ↵ </a></div>
  </div>
  <aside class="dfn-panel" data-for="valdef-display-ruby">
   <b><a href="#valdef-display-ruby">#valdef-display-ruby</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-display-ruby">2.1.2. 
Non-Inline Ruby</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-ruby-position">
   <b><a href="#propdef-ruby-position">#propdef-ruby-position</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-ruby-position">1.1. 
Module interactions</a>
    <li><a href="#ref-for-propdef-ruby-position①">3. 
Ruby Layout</a>
    <li><a href="#ref-for-propdef-ruby-position②">3.1. 
Inter-character Ruby Layout</a>
    <li><a href="#ref-for-propdef-ruby-position③">4.1. 
Ruby Positioning: the ruby-position property</a> <a href="#ref-for-propdef-ruby-position④">(2)</a>
    <li><a href="#ref-for-propdef-ruby-position⑤">4.2. 
Sharing Annotation Space: the ruby-merge property</a>
    <li><a href="#ref-for-propdef-ruby-position⑥"> Changes since the 5 August 2014 WD</a> <a href="#ref-for-propdef-ruby-position⑦">(2)</a>
    <li><a href="#ref-for-propdef-ruby-position⑧"> Changes since the 30 June 2011 WD</a> <a href="#ref-for-propdef-ruby-position⑨">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-position-inter-character">
   <b><a href="#valdef-ruby-position-inter-character">#valdef-ruby-position-inter-character</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-position-inter-character">3.1. 
Inter-character Ruby Layout</a> <a href="#ref-for-valdef-ruby-position-inter-character①">(2)</a> <a href="#ref-for-valdef-ruby-position-inter-character②">(3)</a> <a href="#ref-for-valdef-ruby-position-inter-character③">(4)</a>
    <li><a href="#ref-for-valdef-ruby-position-inter-character④">3.3. 
Breaking Across Lines</a> <a href="#ref-for-valdef-ruby-position-inter-character⑤">(2)</a>
    <li><a href="#ref-for-valdef-ruby-position-inter-character⑥">3.3.2. 
Breaking Within Bases</a>
    <li><a href="#ref-for-valdef-ruby-position-inter-character⑦"> Changes since the 30 June 2011 WD</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-ruby-merge">
   <b><a href="#propdef-ruby-merge">#propdef-ruby-merge</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-ruby-merge">2.4. 
Autohiding Base-identical Annotations</a> <a href="#ref-for-propdef-ruby-merge①">(2)</a>
    <li><a href="#ref-for-propdef-ruby-merge②">3. 
Ruby Layout</a>
    <li><a href="#ref-for-propdef-ruby-merge③">4.2. 
Sharing Annotation Space: the ruby-merge property</a>
    <li><a href="#ref-for-propdef-ruby-merge④"> Changes since the 5 August 2014 WD</a>
    <li><a href="#ref-for-propdef-ruby-merge⑤"> Changes since the 30 June 2011 WD</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-merge-separate">
   <b><a href="#valdef-ruby-merge-separate">#valdef-ruby-merge-separate</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-merge-separate">2.4. 
Autohiding Base-identical Annotations</a>
    <li><a href="#ref-for-valdef-ruby-merge-separate①">4.2. 
Sharing Annotation Space: the ruby-merge property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-merge-collapse">
   <b><a href="#valdef-ruby-merge-collapse">#valdef-ruby-merge-collapse</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-merge-collapse">2.4. 
Autohiding Base-identical Annotations</a>
    <li><a href="#ref-for-valdef-ruby-merge-collapse①">4.2. 
Sharing Annotation Space: the ruby-merge property</a>
    <li><a href="#ref-for-valdef-ruby-merge-collapse②"> Changes since the 5 August 2014 WD</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-merge-auto">
   <b><a href="#valdef-ruby-merge-auto">#valdef-ruby-merge-auto</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-merge-auto">2.4. 
Autohiding Base-identical Annotations</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="propdef-ruby-align">
   <b><a href="#propdef-ruby-align">#propdef-ruby-align</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-propdef-ruby-align">3. 
Ruby Layout</a>
    <li><a href="#ref-for-propdef-ruby-align①">4.3. 
Ruby Text Distribution: the ruby-align property</a> <a href="#ref-for-propdef-ruby-align②">(2)</a>
    <li><a href="#ref-for-propdef-ruby-align③">5.1. 
Overhanging Ruby</a>
    <li><a href="#ref-for-propdef-ruby-align④"> Changes since the 30 June 2011 WD</a> <a href="#ref-for-propdef-ruby-align⑤">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-align-start">
   <b><a href="#valdef-ruby-align-start">#valdef-ruby-align-start</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-align-start">4.3. 
Ruby Text Distribution: the ruby-align property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-align-center">
   <b><a href="#valdef-ruby-align-center">#valdef-ruby-align-center</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-align-center">4.3. 
Ruby Text Distribution: the ruby-align property</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-align-space-between">
   <b><a href="#valdef-ruby-align-space-between">#valdef-ruby-align-space-between</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-align-space-between">4.3. 
Ruby Text Distribution: the ruby-align property</a> <a href="#ref-for-valdef-ruby-align-space-between①">(2)</a>
    <li><a href="#ref-for-valdef-ruby-align-space-between②"> Changes since the 30 June 2011 WD</a> <a href="#ref-for-valdef-ruby-align-space-between③">(2)</a>
   </ul>
  </aside>
  <aside class="dfn-panel" data-for="valdef-ruby-align-space-around">
   <b><a href="#valdef-ruby-align-space-around">#valdef-ruby-align-space-around</a></b><b>Referenced in:</b>
   <ul>
    <li><a href="#ref-for-valdef-ruby-align-space-around">4.3. 
Ruby Text Distribution: the ruby-align property</a> <a href="#ref-for-valdef-ruby-align-space-around①">(2)</a>
    <li><a href="#ref-for-valdef-ruby-align-space-around②"> Changes since the 30 June 2011 WD</a> <a href="#ref-for-valdef-ruby-align-space-around③">(2)</a> <a href="#ref-for-valdef-ruby-align-space-around④">(3)</a>
   </ul>
  </aside>
<script>/* script-dfn-panel */

document.body.addEventListener("click", function(e) {
    var queryAll = function(sel) { return [].slice.call(document.querySelectorAll(sel)); }
    // Find the dfn element or panel, if any, that was clicked on.
    var el = e.target;
    var target;
    var hitALink = false;
    while(el.parentElement) {
        if(el.tagName == "A") {
            // Clicking on a link in a <dfn> shouldn't summon the panel
            hitALink = true;
        }
        if(el.classList.contains("dfn-paneled")) {
            target = "dfn";
            break;
        }
        if(el.classList.contains("dfn-panel")) {
            target = "dfn-panel";
            break;
        }
        el = el.parentElement;
    }
    if(target != "dfn-panel") {
        // Turn off any currently "on" or "activated" panels.
        queryAll(".dfn-panel.on, .dfn-panel.activated").forEach(function(el){
            el.classList.remove("on");
            el.classList.remove("activated");
        });
    }
    if(target == "dfn" && !hitALink) {
        // open the panel
        var dfnPanel = document.querySelector(".dfn-panel[data-for='" + el.id + "']");
        if(dfnPanel) {
            dfnPanel.classList.add("on");
            var rect = el.getBoundingClientRect();
            dfnPanel.style.left = window.scrollX + rect.right + 5 + "px";
            dfnPanel.style.top = window.scrollY + rect.top + "px";
            var panelRect = dfnPanel.getBoundingClientRect();
            var panelWidth = panelRect.right - panelRect.left;
            if(panelRect.right > document.body.scrollWidth && (rect.left - (panelWidth + 5)) > 0) {
                // Reposition, because the panel is overflowing
                dfnPanel.style.left = window.scrollX + rect.left - (panelWidth + 5) + "px";
            }
        } else {
            console.log("Couldn't find .dfn-panel[data-for='" + el.id + "']");
        }
    } else if(target == "dfn-panel") {
        // Switch it to "activated" state, which pins it.
        el.classList.add("activated");
        el.style.left = null;
        el.style.top = null;
    }

});
</script>